如何在VSCode扩展中更改现有编辑器上下文菜单的位置?

huangapple go评论58阅读模式
英文:

How to change the position of existing editor context menus in VSCode extension?

问题

我有一个使用其格式化提供程序API实现的Visual Studio Code扩展程序,'格式化文档'选项在提供程序注册后会出现在编辑器上下文菜单的某个特定位置。是否可以更改此上下文菜单选项的位置,即将其上移或下移,特别是针对我的扩展程序?

英文:

I have a vscode extension with custom formatter implemented using its formatting provider api. The 'format document' option appears in a certain position in the editor context menu once the provider is registered. Is it possible to change the location of this context menu option, i.e., move it up or down, specifically for my extension?

答案1

得分: 0

是的,你可以。你只需要玩弄分组和菜单排序,如“Contribution Points”文档中详细说明的那样。例如,如果你将上下文菜单项的组定义为"group": "navigation",它将显示在所有项目的顶部。希望这能有所帮助。

英文:

Yes, you can. You just have to play with groups and sorting of menus, as detailed in the Contribution Points documentation (https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups).

For instance, if you define the group for your context menu item as "group": "navigation", it will be displayed on top of all items.

Hope this helps

huangapple
  • 本文由 发表于 2023年5月17日 16:04:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/76269820.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定