Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Cli support : scaffold generation for Extension, Command, Views, and automatic registration #19

Open
normal-coder opened this issue Dec 7, 2024 · 0 comments

Comments

@normal-coder
Copy link

Description

Currently, this project supports most of the VSCode API and development capabilities.

Expect support for scaffolding commands (similar to cobra in Golang), and support for structuring extensions such as Extension, Command, Views, etc. independently. Realize framework development.

Scaffold generation for Extension, Command

Provide a command-line capability to add the generation of Extension, Command, View scaffold code.

reactive-vscode command add xxx
reactive-vscode extension add xxx
reactive-vscode view add xxx

Automatic registration

By engineering structuring. Supports directory structures such as src/commands, src/extensions, src/views, etc., by encapsulating corresponding code snippets, simplifying the complexity of packages.json and extensions.ts code, and improving readability.

Coordinates with CLI tools for use, it will greatly enhance the VSCode extension developer experience (DX).

The following is an imaginative engineering structure scenario:

➜  tree -L 3 .                                
  ├── package.json
  ├── ...
  ├── src
+ │   ├── commands
+ │   │   ├── HelloWorld.ts
+ │   │   └── Test.ts
+ │   ├── views
+ │   ├── ...
  │   ├── configs.ts
  │   ├── extension.ts
  │   └── utils.ts
  ├── ...
  └── tsup.config.ts
- import { defineExtension, useCommand, useIsDarkTheme, watchEffect } from 'reactive-vscode'
+ import { defineExtension, useIsDarkTheme, watchEffect } from 'reactive-vscode'
  import { window } from 'vscode'
  import { message } from './configs'
  import { logger } from './utils'
+ import { useHelloWorldCommand, useTestCommand } from './commands'


 export = defineExtension(() => {
   logger.info('Extension Activated')

+ // It is only necessary to introduce through methods (or automatic registration)
+ // From the perspective of development experience, explicit declaration of the project will have better readability.


-  // useCommand('gitee-chatcode.helloWorld', () => {
-  //   window.showInformationMessage(message.value + "dasdas")
-  // })
+  useHelloWorldCommand() // Improved

-  // useCommand('gitee-chatcode.test', () => {
-  //   window.showInformationMessage("test")
-  // })
+  useTestCommand() // Improved

    const isDark = useIsDarkTheme()
    watchEffect(() => {
      logger.info('Is Dark Theme:', isDark.value)
    })
  })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant