How to quickly search for a symbol under cursor in all project files in Visual Studio Code

Viewed 3000

While browsing through C++ code in VS Code, I am looking for a better way (possibly just a simple keyboard shortcut after some configuration) to do the following:

  1. My cursor is hovering over a symbol (e.g. MyClass class).
  2. I want to search for this symbol in all project files (i.e. perform Ctrl + Shift + F search on the symbol under cursor)

At present I don't know a better way then to copy the symbol name -> Ctrl + Shift + F -> paste the name -> hit 'Enter'.

3 Answers

As of version 1.42.0 there is no single-keystroke way of doing it (although I would appreciate this very much).

You could use the sequence Ctrl-D, Ctrl-Shift-F.
("Add Selection To Next Find Match")

Better: There is an extension exactly for this use case, it's called:
"Search Under Cursor"

Related