I'd like to map the ReSharper_ToggleSuspended
command to a button on a toolbar in VS 2012, but the command is not listed in the ReSharper category of Commands availabe in Customize > Commands dialog.
Is there a way to do this?
Borrowed from the suggestion on the R# issue tracker for this issue.
In the VS Package Manager Console, you can run these commands to add the ReSharper_ToggleSuspended
command to an existing toolbar named "R#".
$cmdBarName = "R#"
$cmdName = "ReSharper_ToggleSuspended"
$cmdText = "R# Active"
$toolbarType = [EnvDTE.vsCommandBarType]::vsCommandBarTypeToolbar
#----If you have a command bar you want to use---
#$cmdBar = $dte.CommandBars.Item($cmdBarName)
# - or you can create one -
$cmdBar = $dte.Commands.AddCommandBar($cmdBarName, $toolbarType)
#------
$cmdItem = $dte.Commands.Item($cmdName).AddControl($cmdBar, 1)
$cmdItem.Caption = $cmdText
You can use any existing toolbar, or create one from scratch. I had originally added a new toolbar using the UI but updated this to include how to create one, as well as to update the Button text to use $cmdText.
Rick Strahl has a decent writeup on the command bars, if you are interested.
I think that the Resharper_ToggleSuspended
command relates to the 'Suspend' button under Tools
->Options...
->Resharper
->General
. It seems you can't have items from the Options dialogue as commands. Possibly your only choice is to assign a keyboard shortcut to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With