mark
mark

Reputation: 5469

Is there a Visual Studio keyboard shortcut for "go to variable type definition" for "auto" variables in C++?

I often use F12 Edit.GoToDefinition and Alt+F12 Edit.PeekDefinition for jumping around and looking at code. It is pretty useful for finding the type of a variable too, Alt-F12 on a variable then scoot over and Alt-F12 on the type and I can look at object definitions, for example.

However, if you're using the C++ auto keyword, you can't Alt-F12 on it to jump to the deduced type. If you hover over the variable like item below, you can see the deduced type okay in the content popup, but you can't click on anything to jump to it. Looking at the options-keyboard-shortcuts, it seems like running Edit.GoToTypeDefinition Ctrl+K, Ctrl+Shift+T on the variable was what I'm looking for, but it doesn't seem to work even on regular variables, much less auto ones. Anyone run into this or have a shortcut solution?

if ( const auto item = getFirst() ) { {
    ...
}

Upvotes: 2

Views: 1156

Answers (1)

Aykhan Hagverdili
Aykhan Hagverdili

Reputation: 29975

I hold Ctrl then click on auto (or any other type) and it takes me where the type is defined. Not strictly a kyboard shortcut, but it works nevertheless.

Upvotes: 3

Related Questions