I was able to figure out the right command groups for the context menu. It turns out the various editors all use separate context ids and so have to be managed as separate menus so this gets messy quick.
Steps
- I used the
HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\General
key and EnableVSIPLogging value of 1 to enable logging.
- I then navigated into the editor and with the mouse on an empty area press CTRL-SHIFT and then right click the mouse
This gives the info a menu group
like and it looks like this:
---------------------------
VSDebug Message
---------------------------
Menu data:
Guid = {D7E8C5E1-BDB8-11D0-9C88-0000F8040A53}
GuidID = 358
CmdID = 53
Type = 0x00000400
Flags = 0x00000000
NameLoc = ASPX Context
---------------------------
OK
---------------------------
The important values are the GUID and the CommandID.
Add the Guid and Command ID under Symbols
like this to register the command set mapping the Guid to the CommandSet and the CommandId to the context menu values:
<GuidSymbol name="aspxContextCommandSet" value="{D7E8C5E1-BDB8-11D0-9C88-0000F8040A53}">
<IDSymbol name="aspxContextMenu" value="0x0035"/>
</GuidSymbol>
Note that the value maps to the CommandID represented as a hex value.
Then reference this group as a parent for your command group (MyMenuGroup) in the Groups
section:
<Group guid="guidViewInBrowserPackageCmdSet" id="MyMenuGroup" priority="0x0000">
<Parent guid="aspxContextCommandSet" id="aspxContextMenu"/>
</Group>
You reference the menu group you create for you command buttons and point at the context menu created in the previous step.
If you want to do this for multiple editors (ie. the ASPX, HTML, and Code editors for example as I do) you repeat this process for each of your editors by adding both the GuidSymbol and the Group.You'll end up with multiple Group entries for the same MenuGroup point at a different parent and all will activate appropriately.
Works great, but you'll probably have to make sure you filter your OleMenuCommand
objects with a BeforeQueryStatus
event handler to ensure the menu shows only when you actually can handle.