Skip to content

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

@normal-coder

Description

@normal-coder

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)
    })
  })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions