如何在VSCode扩展的资源管理器视图中指定图标的顺序?

在我的分机我有一个资源管理器视图的栏上的一些按钮:如何在VSCode扩展的资源管理器视图中指定图标的顺序?

我怎么可以指定按钮显示的顺序?

我试图在package.json的命令在commands属性的顺序发生变化:

"commands": [ 

{

"command": "codeFragments.exportFragments",

"title": "Export all fragments to Json",

"icon": {

"light": "images/icon-export-light.png",

"dark": "images/icon-export-dark.png"

}

},

{

"command": "codeFragments.importFragments",

"title": "Import fragments from Json",

"icon": {

"light": "images/icon-import-light.png",

"dark": "images/icon-import-dark.png"

}

},

{

"command": "codeFragments.deleteAllFragments",

"title": "Delete all fragments",

"icon": {

"light": "images/icon-delete-light.png",

"dark": "images/icon-delete-dark.png"

}

}

],

还试图在部分重新排序,其中我指定UI,在view/title属性:

"view/title": [ 

{

"command": "codeFragments.exportFragments",

"when": "view == codeFragments",

"group": "navigation"

},

{

"command": "codeFragments.importFragments",

"when": "view == codeFragments",

"group": "navigation"

},

{

"command": "codeFragments.deleteAllFragments",

"when": "view == codeFragments",

"group": "navigation"

}

],

而且当我推送命令订阅时,还尝试更改部分中的顺序:

context.subscriptions.push(

vscode.commands.registerCommand('codeFragments.exportFragments', exportFragments));

context.subscriptions.push(

vscode.commands.registerCommand('codeFragments.importFragments', importFragments));

context.subscriptions.push(

vscode.commands.registerCommand('codeFragments.deleteAllFragments', deleteAllFragments));

但是这些方法都不影响顺序,按钮总是以看似偶然的顺序出现。

指定订单的正确方法是什么?

回答:

调试vscode源一段时间后,我发现该溶液中,分选发生在这里:https://github.com/Microsoft/vscode/blob/master/src/vs/platform/actions/electron-browser/menusExtensionPoint.ts#L365

基本上订单号可以在@符号之后附加到命令的组的名称,所以我必须做到以下几点。

"view/title": [ 

{

"command": "codeFragments.exportFragments",

"when": "view == codeFragments",

"group": "[email protected]"

},

{

"command": "codeFragments.importFragments",

"when": "view == codeFragments",

"group": "[email protected]"

},

{

"command": "codeFragments.deleteAllFragments",

"when": "view == codeFragments",

"group": "[email protected]"

}

],

,并找到在此之后,我试图重新谷歌,事实证明这是正确的文件已经,但不知何故,我错过了寻找它,当第一次:https://code.visualstudio.com/docs/extensionAPI/extension-points#_sorting-inside-groups

以上是 如何在VSCode扩展的资源管理器视图中指定图标的顺序? 的全部内容, 来源链接: utcz.com/qa/258554.html

回到顶部