英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论