我正在构建一个Visual Studio Code扩展,该扩展需要仅在命令调色板中可用的命令(据我所知)。我希望能够使用VS Code的API在JavaScript中控制此命令。我在找这样的东西:
vscode.commandPalette.run (A function in command palette)
详细说明如下:https://code.visualstudio.com/api/extension-guides/command.
下面是取自该文档的示例:
import * as vscode from 'vscode'; function commentLine() { vscode.commands.executeCommand('editor.action.addCommentLine'); }
同样的文档页面也链接到这个页面,关于存在哪些内置命令及其命令id: https://code.visualstudio.com/api/references/commands
为了你的学习,如果你感兴趣,我在谷歌上搜索"vscode api run command
"。