Command配置
# Command配置
上面提到了生成一个command
只需要 2 步,先是利用vscode.commands.registerCommand
注册一个,然后再到package.json
里的contributes.commands
中配置即可。围绕command
还可以做一些其他事情,最常见的就是配置右键菜单和快捷键。
"contributes":{
"menus": {
"editor/context": [
{
"when": "editorHasSelection && resourceFilename =~ /.js|.vue|.ts/", // 出现时机,当编辑器中有选中文本同时文件名后缀是js/vue/ts
"command": "extension.starling_textSearch", // 需要在`contributes.commands`存在此命令
"group": "6_Starling" // 命令所在的组,右键菜单可以分组,组与组之间存在分隔线
},
]
}
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
上次更新: 2023/10/17, 16:50:29