You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/extensibility/visualstudio.extensibility/command/command.md
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,6 @@ The [`CommandConfiguration`](/dotnet/api/microsoft.visualstudio.extensibility.co
53
53
| Icon | CommandIconConfiguration | No | Commands can be displayed in the UI as either just an Icon, an Icon with text, or just text. This property configures what that icon should be, if any, and how it should be displayed. |
54
54
| Shortcuts | CommandShortcutConfiguration[]| No | Defines the set of key combinations that can be used to execute the command. Shortcuts can be scoped down to only be applicable to specific IDE contexts. See at [Shortcuts](#shortcuts). |
55
55
| ClientContexts[]| String | No | Client contexts requested by the command. By default the Shell and Editor contexts are returned. A client context is a snapshot of specific IDE states at the time a command was originally executed. Since these commands are executed asynchronously this state could change between the time the user executed the command and the command handler running. See at [Client contexts](./../inside-the-sdk/activation-constraints.md#client-context-keys). |
56
-
| Priority | uint | No | Describes the display order of the command relative to other commands parented to the same `CommandPlacement.KnownPlacements`. |
57
56
58
57
### Example
59
58
@@ -86,14 +85,20 @@ There's a set of well-defined places in Visual Studio where commands can be plac
86
85
-`ViewOtherWindowsMenu` - The command will be placed in a group under the top-level "View" -> "Other Windows" menu in Visual Studio.
87
86
-`ExtensionsMenu` - The command will be placed in a group under the top-level "Extensions" menu in Visual Studio.
88
87
89
-
Commands parented to the same placement are sorted based on their `Priority` property, relative to other commands or menus with the same placement.
88
+
Commands can also be placed using the `CommandPlacement.VsctParent` method by the specifying the `Guid` and `Id` of group defined via VSCT.
89
+
90
+
Commands parented to the same group are sorted based on their placement's `Priority` property, relative to other commands or menus with the same placement. The default `Priority` value for a `CommandPlacement` is `0` and can be modified by calling the `CommandPlacement.WithPriority` method, passing in the desired `Priority` value.
@@ -49,7 +50,6 @@ The [`MenuConfiguration`](/dotnet/api/microsoft.visualstudio.extensibility.comma
49
50
| TooltipText | String | No | The text to display as the tooltip when the menu is hovered or focused. Surround this string with the '%' character to enable localizing this string. See at [Localize metadata](localize-metadata.md). |
50
51
| Placements | CommandPlacement[]| No | Specifies the existing Groups within Visual Studio that the menu will be parented to. See at [Place a menu in the IDE](#place-a-menu-in-the-ide). |
51
52
| Children | MenuChild[]| No | Describes the set of commands, menus and groups that should be parented to this menu. The order that these items are defined in the array represent the order that they'll appear visually in the IDE. See at [Place items on a menu](#place-items-on-a-menu)|
52
-
| Priority | uint | No | Describes the display order of the menu relative to other manus/commands parented to the same `CommandPlacement.KnownPlacements`. |
53
53
54
54
## Place a menu in the IDE
55
55
@@ -168,7 +168,6 @@ The [`ToolbarConfiguration`](/dotnet/api/microsoft.visualstudio.extensibility.co
168
168
| TooltipText | String | No | The text to display as the tooltip when the toolbar is hovered or focused. Surround this string with the '%' character to enable localizing this string. See at [Localize metadata](localize-metadata.md). |
169
169
| Placements | CommandPlacement[]| No | Specifies the existing Groups within Visual Studio that the toolbar will be parented to. See at [Place a command in the IDE](command.md#place-a-command-in-the-ide). Leaving this property as `null` will place the toolbar on the Standard Toolbar Bar and can be made visible by selecting the toolbar in the `View -> Toolbars` menu |
170
170
| Children | ToolbarChild[]| No | Describes the set of commands, menus and groups that should be parented to this toolbar. The order that these items are defined in the array represent the order that they'll appear visually in the IDE. See at [Place items on a toolbar](#place-items-on-a-toolbar)|
171
-
| Priority | uint | No | Describes the display order of the toolbar relative to other toolbar with the same placement. |
172
171
173
172
## Place items on a toolbar
174
173
@@ -243,7 +242,6 @@ The [`CommandGroupConfiguration`](/dotnet/api/microsoft.visualstudio.extensibili
|Children|GroupChild[] |No|Describesthesetofcommandsandmenusthatshouldbeparentedtothisgroup. Theorderthattheseitemsaredefinedinthearrayrepresenttheorderthatthey'll appear visually in the IDE. See at [Place items on a group](#place-items-on-a-group) |
@@ -341,3 +339,31 @@ public static ToolbarConfiguration MyToolbar => new("%MyToolbar.DisplayName%")
341
339
},
342
340
};
343
341
```
342
+
343
+
## Placement ordering (Priority)
344
+
345
+
Placementsareorderedbasedonthevalueoftheir `Priority` propertywhenparentedtoacontroldefinedinVSCT, relativetootheritemsparentedtothesamegroup, menu, ortoolbar. The `Priority` propertyisan `unsignedshort`. Thedefault `Priority` valuefora `CommandPlacement` and `GroupPlacement` is `0` andcanbemodifiedbycallingthe `CommandPlacement.WithPriority` or `GroupPlacement.WithPriority` methods, passinginthedesired `Priority` value. The `Priority` canalsobesetbyusingthe `CommandPlacement.VsctParent` and `GroupPlacement.VsctParent` methodsandpassinginthedesired `Priority` directly.
346
+
347
+
The `Priority` propertyisnotinvolved when parenting items to controls defined via configuration objects using the VisualStudio.Extensibility model (i.e. the group, menu, or toolbar being parented to was defined using `CommandGroupConfiguration`, `MenuConfiguration`, or `ToolbarConfiguration`).
0 commit comments