ARTICLE AD BOX
I am creating a copilot like VSIX extension on VS2026 to use with my offline LLM server.
I have created the dropdown Menu button and submenu buttons ( which seem to be always greyed out/disabled ).
I have tried to get some help with chatgpt/google gemini but i havent been able to solve the disabled status of the submenu buttons.
The menu is correctly shown in VS2026-Tools and on right click (code selection).
I am new to VSIX and WPF projects.
What is the correct way to enable these buttons?
What keeps them disabled?
Any help is appreciated.
Frontend WPF Code:
<?xml version="1.0" encoding="utf-8"?> <Extern href="stdidcmd.h"/> <Extern href="vsshlids.h"/> <Symbols> <GuidSymbol name="guidSsmsAiExtensionCmdSet" value="{A9C1F99A-5E17-4E31-BB10-9F2C8A4F8D11}"> <IDSymbol name="MyMenuGroup" value="0x1020" /> <IDSymbol name="MySubMenuGroup" value="0x1021" /> <IDSymbol name="MyMenu" value="0x1030" /> <IDSymbol name="ShowToolWindowCommandId" value="0x0100"/> <IDSymbol name="GenerateSqlContextCommandId" value="0x0101"/> </GuidSymbol> <GuidSymbol name="guidImages" value="{68021190-7B51-4034-AD88-348128373E72}" > <IDSymbol name="aiIcon1" value="1" /> </GuidSymbol> </Symbols> <Commands> <Menus> <Menu guid="guidSsmsAiExtensionCmdSet" id="MyMenu" priority="0x0200" type="Menu"> <Parent guid="guidSsmsAiExtensionCmdSet" id="MyMenuGroup"/> <Icon guid="guidImages" id="aiIcon1" /> <Strings> <ButtonText>AI Assistant</ButtonText> </Strings> </Menu> </Menus> <Groups> <Group guid="guidSsmsAiExtensionCmdSet" id="MyMenuGroup" priority="0x0600"> <Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/> </Group> <Group guid="guidSsmsAiExtensionCmdSet" id="MyMenuGroup" priority="0x0100"> <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_CODEWIN"/> </Group> <Group guid="guidSsmsAiExtensionCmdSet" id="MySubMenuGroup" priority="0x0000"> <Parent guid="guidSsmsAiExtensionCmdSet" id="MyMenu"/> </Group> </Groups> <Buttons> <Button guid="guidSsmsAiExtensionCmdSet" id="ShowToolWindowCommandId" priority="0x0100" type="Button"> <Parent guid="guidSsmsAiExtensionCmdSet" id="MySubMenuGroup"/> <Icon guid="guidImages" id="aiIcon1" /> <Strings> <ButtonText>Open Chat</ButtonText> </Strings> </Button> <Button guid="guidSsmsAiExtensionCmdSet" id="GenerateSqlContextCommandId" priority="0x0101" type="Button"> <Parent guid="guidSsmsAiExtensionCmdSet" id="MySubMenuGroup"/> <Icon guid="guidImages" id="aiIcon1" /> <Strings> <ButtonText>Generate Context</ButtonText> </Strings> </Button> </Buttons> <Bitmaps> <Bitmap guid="guidImages" href="Resources\AiAssistantIcon_16x16.png" usedList="aiIcon1"/> </Bitmaps> </Commands>this is how i am registering everything on the backend:
public static async Task InitializeAsync(AsyncPackage package) { // Switch to UI Thread immediately await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); var commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; // Use DTE2 for better VS 2026 compatibility var dte = await package.GetServiceAsync(typeof(SDTE)) as EnvDTE80.DTE2; if (commandService != null && dte != null) { // Don't just discard the instance, ensure it's fully constructed var unused = new CommandHandlers(package, commandService, (EnvDTE.DTE) dte); } } private void RegisterCommands(OleMenuCommandService commandService) { // 1. Show Tool Window Command var showWindowCommand = new OleMenuCommand( ShowAiToolWindowExecute, new CommandID(CommandSet, ShowToolWindowCommandId)); showWindowCommand.Supported = true; showWindowCommand.Enabled = true; showWindowCommand.Visible = true; showWindowCommand.BeforeQueryStatus += OnBeforeQueryStatus; commandService.AddCommand(showWindowCommand); }