vscode-ext-commands
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVS Code extension command contribution
VS Code扩展命令贡献
This skill helps you to contribute commands in VS Code extensions
本技能可帮助你在VS Code扩展中贡献命令
When to use this skill
何时使用本技能
Use this skill when you need to:
- Add or update commands to your VS Code extension
当你需要以下操作时使用本技能:
- 为你的VS Code扩展添加或更新命令
Instructions
说明
VS Code commands must always define a , independent of its category, visibility or location. We use a few patterns for each "kind" of command, with some characteristics, described below:
title-
Regular commands: By default, all commands should be accessible in the Command Palette, must define a, and don't need an
category, unless the command will be used in the Side Bar.icon -
Side Bar commands: Its name follows a special pattern, starting with underscore () and suffixed with
_, like#sideBarfor instance. Must define an_extensionId.someCommand#sideBar, and may or may not have some rule foricon. Side Bar exclusive commands should not be visible in the Command Palette. Contributing it to theenablementorview/title, we must inform order/position that it will be displayed, and we can use terms "relative to other command/button" in order to you identify the correctview/item/contextto be used. Also, it's a good practice to define the condition (group) for the new command is visible.when
VS Code命令必须始终定义一个,与其分类、可见性或位置无关。我们针对每种类型的命令使用了一些模式,各有特点,如下所述:
title-
常规命令:默认情况下,所有命令都应在Command Palette中可访问,必须定义一个,不需要
category,除非该命令将在Side Bar中使用。icon -
Side Bar命令:其名称遵循特殊模式,以下划线()开头并以
_结尾,例如#sideBar。必须定义一个_extensionId.someCommand#sideBar,可以有也可以没有icon规则。仅在Side Bar中使用的命令不应在Command Palette中可见。将其贡献到enablement或view/title时,我们必须指定它将显示的顺序/位置,并且可以使用“相对于其他命令/按钮”的术语来帮助你确定要使用的正确view/item/context。此外,定义新命令可见的条件(group)是一种最佳实践。when