NightShovel
NightShovel

Reputation: 3252

What is the keyboard shortcut to go to the next Quick Action (Light Bulb) suggestion in a file?

I would like to know what the keyboard shortcut is in Visual Studio 2015 which allows me to advance to the next Quick Action in the file I am viewing.

The behavior I am looking for would be similar to ReSharper's "next code issue" (F12) shortcut.

Upvotes: 20

Views: 2096

Answers (4)

JestaBlunt
JestaBlunt

Reputation: 173

was searching for the same and with help of this post I was able to found the following, which suits my needs more:

for me in VS2017, the right combination was "Edit.GoToNextIssueinFile" (Alt+PgDn) and vice versa.

enter image description here

Upvotes: 7

M-Razavi
M-Razavi

Reputation: 3467

F8 (and Shift+F8 to go backwards).

Or at least that's what it is in my keyboard profile – you can go to Tools → Options → Environment → Keyboard and check out Edit.GoToNextLocation.

Note: If you configured Visual Studio using VB keyboard settings, no key has been assigned to this function. You need to pick your own and assign them.

You use CTRL+Shift+F12 which is View.NextError .There is a difference between View.NextError and Edit.GoToNextLocation.

Upvotes: 0

wp78de
wp78de

Reputation: 18980

The closest solution might be indeed to move to the next/previous error with the built-in hotkeys (F8/Shift+F8 or Ctrl+Shift+F12) and then invoke the light bulb action.

The only way I see to get what you want might be a custom Visual studio extension. However, I am not sure if it is feasible. One could try to query all global suggested actions and/or move the caret over the code and query HasSuggestedActionsAsync - since SuggestedActionSet represents a list of suggested actions that are all applicable to a span of text in an ITextBuffer. This would be definitively slow. I guess ReSharper stores the suggestions while parsing the code in an array to make this feature available.

Here is a VSSDK extensibility sample, that provides somewhat of a starting point. See also: Walkthrough: Displaying Light Bulb Suggestions.

Upvotes: 5

bitbonk
bitbonk

Reputation: 49649

The best solution I have found so far is this:

  1. Sort the "Error List" by file name
  2. Select the first error of your current file in the list
  3. Use F8 and Shift+F8 to navigate to the issues in the file.

Apart from this beeing quite cumbersome, the downside here is also that once you reached the end (or start) of the file it will continue with the next (or previous) file in the "Error List".

Upvotes: 5

Related Questions