Visual Studio 2022 How to locate current file in Class View using a shortcut?

Viewed 28

I can use a short cut to locate the current file in solution explorer, but I can't do the same for Class View.

I don't want to always track the current file open. I want to press a shortcut and see that file in the class view.

1 Answers

I believe what you are seeking is the shortcut View.SynchronizeClassView. By default this has no shortcut assigned to it.

Go to Tools → Options → Environment → Keyboard and filter the shortcut list by searching for "View.SynchronizeClassView". Select the item in the list, create a shortcut of your liking, and assign it.

class view shortcut

After doing so, when you perform the shortcut, class view should sync to where your cursor is at in the code like so:

classview

Related