Specifying shortcut keys in Actions.xml

I am using Resharper 7 with Visual Studio 2010 and trying to specify shortcut in Actions.xml. Here is how I do it:

  <insert group-id="ReSharper" position="last">
    <action-group id="MyPlugins" text="MyPlugins">
      <action id="ReplaceWithAutocomplete" text="Replace with Autocomplete" shortcut="Control+Shift+J"/>      

However this solution dosn't work. I see my action in a menu, but there is no shortcut assigned to it.

I also tried to specify a shortcut using Visual Studio 2010 keyboard settings. It works well until a next Visual Studio restart. Is there a way to stick shortcut to my custom Resharper action?


Comment actions Permalink

I installed 7.1 SDK. I am using VS2010. I still can't get shortcut keys to work.

I tried Gist and FindText plugins from SDK Samples. Those also fail to register shortcut keys. Please help. I am tired of reassigning shortcuts after each Visual Studio restart.

Comment actions Permalink

I use the following as an alternative until the shortcuts within action.xml work...

var dte = Shell.Instance.GetComponent<DTE>();
var command = dte.Commands.Item(macroName);
command.Bindings = new Object[] {keyboardShortcut};

Full code in testcop.codeplex.com

Comment actions Permalink

Unfortunately, there's a bug in 7.x that causes the shortcuts to be lost when Visual Studio restarts. The builtin Actions that ship with ReSharper are statically registered with Visual Studio, and a flag is stored to say that the shortcut is set. When registering the Actions for a plugin, they are registered as temporary Visual Studio commands, and deleted at the end of the VS session, but the shortcut flag is kept. The next time VS starts, it registers the Action again, but not the shortcut, because the flag isn't reset. Also, because the command is deleted, any customised shortcut is lost - and the workaround you've mentioned suffers the same problem.

Here's the YouTrack ticket: http://youtrack.jetbrains.com/issue/RSRP-337038


Please sign in to leave a comment.