I seem to recall an option in pre-2022 versions of Visual Studio that allowed you to right-click on a variable, field, or property and select "Go to Type Definition". This appears to be missing in VS 2022.
So, if I have a variable of type Customer
called myCust
and I want to see it’s type definition, it is a two-step process:
- Right-click the variable
myCust
and select Go to Definition, which takes me to there the variable is declared (i.e., a line of code likeCustomer myCust;
) - Then I need to right click on the type name
Customer
and again select Go to Definition….which finally takes me to where I wanted to go in the first place (that is, the definition of the classCustomer
)
Is there now no way to navigate directly with a single click from a variable instance to the the definition of that variable’s type?
2
Answers
Holding down Control when left-clicking will go to the definition of the type – that is working for me in VS 2022.
It appears that F12 is also a hotkey that can do this after you have clicked the type, but I prefer the Control + Click.
I’m using Visual Studio 2022 Community Edition. You can get back Go to Type Definition with the following steps.
Tools > Customize > Commands > Context Menu > Editor Context Menus | Code Window > Add Command > Edit > Go to Type Definition
At this time, you can click the right button again to see Go to Type Definition. Of course, you can also define Go to Type Definition in the same way