Command refers to the custom function registered in the extension, which will be called when the command is triggered. Registering a new command is divided into 2 steps:

    1 . Declare the command through the commands configuration point in package.json, the relevant code is as follows:

    1. "contributes": {
    2. "commands": [{
    3. "command": "extension.helloWorld",
    4. "title": "Hello World"
    5. }]
    6. }

    2 . When the extensionssds is activated, use the API hx.commands.registerCommand or hx.commands.registerTextEditorCommand to implement the command declared above. Note that the command ID must be consistent. The relevant code is as follows:

    1. let disposable = hx.commands.registerCommand('extension.helloWorld', () => {
    2. //do something
    3. });
    4. context.subscriptions.push(disposable)