Skip to content

How to use Bing Code Search when ReSharper is installed

Microsoft Research just released a cool add-in for Visual Studio 2013 called Bing Code Search.  It allows you to search for code samples from with the IDE and has enough context awareness to use the variables from your code.


If you have ReSharper installed, the two do not play together.  You need to trigger Intellisense to get Bing Code Search to activate. ReSharper overrides the Visual Studio Intellisense for it’s additional functionality.  That prevents Bing Code Search from working.

Hopefully Jetbrains will update ReSharper to work with Bing Code Search and hopefully Microsoft will provide an alternate means of triggering Bing Code Search just read the last paragraph of this post.  In the mean time, you can hack away around the problem by disabling ReSharper when you want to use Bing Code Search.

The easiest A clunky way I found to do that was to write a macro that calls the ReSharper toggle command and then bind that macro as a button on the standard tool bar.  Since originally posting this,  two comments left from JetBrains provide easier ways of doing this.

Install the Virtual Commander (or here) extension.  This tool will let you create commands and extensions.  After installing Virtual Commander and restarting Visual Studio, select “Commands…” from the VCMD menu.  In the Commands panel click the “Add” button.

This will open up the command editor window with a new command already scaffolded.  You just need to add the command that will toggle ReSharper on and off, ReSharper_ToggleSuspended.  The command should look something like this

Imports EnvDTE
Imports EnvDTE80

Public Class C
    Implements VisualCommanderExt.ICommand

    Sub Run(DTE As EnvDTE80.DTE2, package As Microsoft.VisualStudio.Shell.Package) Implements VisualCommanderExt.ICommand.Run
        DTE.ExecuteCommand("ReSharper_ToggleSuspended")
    End Sub
End Class

The text that you enter in the name field will be what shows up as the caption of the button on the tool bar. You can test the command by clicking on the Run button.  You should the Resharper menu disappear from the IDE.  Press Run again to bring it back,

After saving the command, you can add it to a toolbar. I placed it on the standard toolbar, so I would know where it was at all times.  Select Tools->Customize…, then click the Commands tab.  You can put this button anywhere, but I placed it on the Standard menu.  Click the Add Command… button.  Then scroll down the Categories list and click on VCmd.  Select the Command you had entered, if it’s the first one then it will be Command01.  Press the OK button to add the command as a toolbar button, then press Close to close the Customize dialog.

If all went well, you will have a new button on the tool bar, with the name of the command as it’s caption.  And now you can toggle ReSharper on and off at any time.

[Edit]
An easier alternative (thanks to Jura) would be to bind a shortcut key to the ReSharper command.  Another suggestion would be to bind a shortcut key to Tools.LaunchSnippetSearch (thanks to Matt) that would open snippet search pane.  Use Tools->Options->Keyboard to access the key bindings.