Skip to content

Instantly share code, notes, and snippets.

@jrotello
Last active June 10, 2024 12:55
Show Gist options
  • Save jrotello/e17367ff04129dac89bb796bebb198db to your computer and use it in GitHub Desktop.
Save jrotello/e17367ff04129dac89bb796bebb198db to your computer and use it in GitHub Desktop.
Script to add a toolbar and button for toggling the suspended state of ReSharper.

Add Visual Studio Toolbar Button to Toggle the Suspended State of ReSharper

Description

Run this script via the Visual Studio Package Manager Console to add a toolbar button that will toggle the suspended state of ReSharper.

Installation

irm https://gist.github.com/jrotello/e17367ff04129dac89bb796bebb198db/raw/AddResharperToggle.ps1 | iex
$cmdbar_name = 'ReSharper (Custom)'
$ctrl_caption = 'Toggle ReSharper'
$cmdbar = $DTE.CommandBars[$cmdbar_name]
if (-not $cmdbar) {
Write-Host "Creating '$cmdbar_name' toolbar..."
$cmdbar = $DTE.Commands.AddCommandBar($cmdbar_name, [EnvDTE.vsCommandBarType]::vsCommandBarTypeToolbar)
}
if (-not ($cmdbar.Controls | Where-Object Caption -eq $ctrl_caption)) {
Write-Host "Adding '$ctrl_caption' button to '$cmdbar_name' toolbar..."
$ctrl = $DTE.Commands['ReSharper_ToggleSuspended'].AddControl($cmdbar)
$ctrl.Caption = $ctrl_caption
}
@rgribeiro
Copy link

This is great and it's just what I needed! Works like a charm.
Thank you very much.

@jrotello
Copy link
Author

Glad you found it useful. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment