From 0ed689d09916dce441f1e7b42aeed6f67024b4e5 Mon Sep 17 00:00:00 2001 From: vchirikov Date: Wed, 11 Sep 2019 23:34:48 +0300 Subject: [PATCH] feat: Add context menu command closes #8 --- package.json | 2 +- src/GoToDnSpy/GoToDnSpy.cs | 19 +++++++---------- src/GoToDnSpy/GoToDnSpy.csproj | 10 ++++----- src/GoToDnSpy/GoToDnSpyCommands.cs | 17 ++++++++++----- src/GoToDnSpy/GoToDnSpyCommands.vsct | 23 +++++++++++++++++---- src/GoToDnSpy/GoToDnSpyPackage.cs | 9 ++------ src/GoToDnSpy/MemberType.cs | 10 ++++----- src/GoToDnSpy/SettingsDialog.cs | 10 +++++++++ src/GoToDnSpy/source.extension.cs | 7 +------ src/GoToDnSpy/source.extension.vsixmanifest | 2 +- 10 files changed, 63 insertions(+), 46 deletions(-) diff --git a/package.json b/package.json index 6910c93..07cec1c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.0.8", + "version": "1.0.9", "author": "Vladimir Chirikov", "scripts": { "install_tools": "npm install -g commitizen cz-conventional-changelog", diff --git a/src/GoToDnSpy/GoToDnSpy.cs b/src/GoToDnSpy/GoToDnSpy.cs index ad3544c..1d17210 100644 --- a/src/GoToDnSpy/GoToDnSpy.cs +++ b/src/GoToDnSpy/GoToDnSpy.cs @@ -31,16 +31,6 @@ namespace GoToDnSpy /// internal sealed partial class GoToDnSpy { - /// - /// Command ID. - /// - public const int CommandId = 0x0100; - - /// - /// Command menu group (command set GUID). - /// - public static readonly Guid CommandSet = new Guid("4843d15e-dca8-4935-8ba3-66c4d25fb295"); - /// /// VS Package that provides this command, not null. /// @@ -90,9 +80,14 @@ private GoToDnSpy(Package package) if (ServiceProvider.GetService(typeof(IMenuCommandService)) is OleMenuCommandService commandService) { - var menuCommandID = new CommandID(CommandSet, CommandId); - var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); + // Add tools menu command + var menuCommandId = new CommandID(PackageGuids.guidGoToDnSpyPackageCmdSetMenu, PackageIds.GoToDnSpyId); + var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandId); commandService.AddCommand(menuItem); + // Add editor context menu command (right click) + var ctxMenuCommand = new CommandID(PackageGuids.guidGoToDnSpyPackageCmdSetContextMenu, PackageIds.GoToDnSpyContextMenuId); + var ctxMenuItem = new MenuCommand(this.MenuItemCallback, ctxMenuCommand); + commandService.AddCommand(ctxMenuItem); } _statusBar = (IVsStatusbar)ServiceProvider.GetService(typeof(SVsStatusbar)); diff --git a/src/GoToDnSpy/GoToDnSpy.csproj b/src/GoToDnSpy/GoToDnSpy.csproj index 568b91b..a1c7df1 100644 --- a/src/GoToDnSpy/GoToDnSpy.csproj +++ b/src/GoToDnSpy/GoToDnSpy.csproj @@ -83,6 +83,11 @@ Menus.ctmenu + + True + True + GoToDnSpyCommands.vsct + True @@ -95,11 +100,6 @@ - - True - True - GoToDnSpyCommands.vsct - VsctGenerator diff --git a/src/GoToDnSpy/GoToDnSpyCommands.cs b/src/GoToDnSpy/GoToDnSpyCommands.cs index ad41d95..508784b 100644 --- a/src/GoToDnSpy/GoToDnSpyCommands.cs +++ b/src/GoToDnSpy/GoToDnSpyCommands.cs @@ -1,6 +1,6 @@ // ------------------------------------------------------------------------------ // -// This file was generated by Extensibility Tools v1.10.211 +// This file was generated by VSIX Synchronizer // // ------------------------------------------------------------------------------ namespace GoToDnSpy @@ -13,11 +13,16 @@ namespace GoToDnSpy internal sealed partial class PackageGuids { public const string guidGoToDnSpyPackageString = "c827298b-8d81-47c0-bed9-cdf072e68d4f"; - public const string guidGoToDnSpyPackageCmdSetString = "4843d15e-dca8-4935-8ba3-66c4d25fb295"; - public const string guidImagesString = "36462768-caed-442f-be73-841d637c2e3b"; public static Guid guidGoToDnSpyPackage = new Guid(guidGoToDnSpyPackageString); - public static Guid guidGoToDnSpyPackageCmdSet = new Guid(guidGoToDnSpyPackageCmdSetString); + + public const string guidGoToDnSpyPackageCmdSetMenuString = "4843d15e-dca8-4935-8ba3-66c4d25fb295"; + public static Guid guidGoToDnSpyPackageCmdSetMenu = new Guid(guidGoToDnSpyPackageCmdSetMenuString); + + public const string guidImagesString = "36462768-caed-442f-be73-841d637c2e3b"; public static Guid guidImages = new Guid(guidImagesString); + + public const string guidGoToDnSpyPackageCmdSetContextMenuString = "d5d8efc6-dc17-4229-9088-dddf76ac0ab3"; + public static Guid guidGoToDnSpyPackageCmdSetContextMenu = new Guid(guidGoToDnSpyPackageCmdSetContextMenuString); } /// /// Helper class that encapsulates all CommandIDs uses across VS Package. @@ -27,5 +32,7 @@ internal sealed partial class PackageIds public const int MyMenuGroup = 0x1020; public const int GoToDnSpyId = 0x0100; public const int ico = 0x0001; + public const int EditorContextMenuGroup = 0x3020; + public const int GoToDnSpyContextMenuId = 0x4020; } -} +} \ No newline at end of file diff --git a/src/GoToDnSpy/GoToDnSpyCommands.vsct b/src/GoToDnSpy/GoToDnSpyCommands.vsct index c817f05..e0e7424 100644 --- a/src/GoToDnSpy/GoToDnSpyCommands.vsct +++ b/src/GoToDnSpy/GoToDnSpyCommands.vsct @@ -36,9 +36,12 @@ group as the part of a menu contained between two lines. The parent of a group must be a menu. --> - + + + + @@ -52,8 +55,15 @@ DefaultInvisible DynamicVisibility If you do not want an image next to your command, remove the Icon node /> --> - +