VsixCommunity / Community.VisualStudio.Toolkit

Making it easier to write Visual Studio extensions
Other
252 stars 44 forks source link

Tips on adding items to the VS Edit-Advanced Menu and Debug menu #167

Open RobertvanderHulst opened 2 years ago

RobertvanderHulst commented 2 years ago

@madskristensen , I know that in past episodes on youtube you were struggling on how to add items to the Edit-Advanced menu. I had to do something similar and also add items to the Debugger menu. It appears that you were using the incorrect guid. The Guid for the editor options is guidStdEditor The Advanced menu is declared as

<Menu guid="guidStdEditor" id="IDM_VS_EDITOR_ADVANCED_MENU" priority="0xFE00" type="Menu">
        <Parent guid="guidStdEditor" id="IDG_VS_EDITOR_LANGUAGE_INFO"/>
        <Strings>
          <ButtonText>Ad&amp;vanced</ButtonText>
          <CommandName>Ad&amp;vanced</CommandName>
        </Strings>
  </Menu>

The group inside this menu is

<Group guid="guidStdEditor" id="IDG_VS_EDITOR_ADVANCED_CMDS" priority="0xFD00">
        <Parent guid="guidStdEditor" id="IDM_VS_EDITOR_ADVANCED_MENU"/>
</Group>

You can find this in SharedCmdPlace.vsct in the VsSdk includes folder. So to place a button in the Advanced menu you would have to specify

        <Parent guid="guidStdEditor" id="IDG_VS_EDITOR_ADVANCED_CMDS"/>

To add menuitems to the Debug menu I had to include VsDbgCmd.hand vsdebugguids.h This is how I placed an "XSharp" entry in the Debugger menu:

<!--XSharp Debugger Submenu in Debug/Windows-->
      <Menu guid="guidProjectPackage" id="idDebuggerSubMenu" priority="0x100" type="Menu" >
        <Parent guid="guidVSDebugGroup" id="IDG_WINDOWS"/>
        <CommandFlag>IconAndText</CommandFlag>
        <Strings>
          <ButtonText>&amp;XSharp</ButtonText>
          <CommandName>XSharp</CommandName>
        </Strings>
      </Menu>

I hope this helps for a future session about adding items to the menu

Robert

reduckted commented 2 years ago

It would be great to add those GUIDs to the VSCT project. https://github.com/VsixCommunity/Community.VisualStudio.VSCT