loading...

Search features in Visual Studio Code

codevault profile image Sergiu Mureşan ・2 min read

Did you know that, aside from searching for strings (in the current document or in all documents) there are a total of four other search features inside Visual Studio Code? Let's take a look!

1) Search file (CTRL + P)

This is simple, if you know the name of the file, there is no longer a need to go into the file explorer and select. Simply type in the full or partial name and VSCode will automatically look into your current workspace and display the ones that contain the name you just wrote (at the top of the list would be the files already open).

Example video:

2) Search for symbol (CTRL + T)

If you know, for example, the name of a private function but you don't exactly know its location, this can come in handy. Simply hit the shortcut (or open the command pallete and prefix it with #) and type in the function's name, you will get a list of symbols preceded by their file location.

Example video:

3) Search local symbol (CTRL + SHIFT + O)

Same as above, just in the current source file. You can also open the command pallete and type @.

A bonus feature from the one above is, if you prefix the search with : you will group them by symbol type so it's easier to find if you don't know its full name.

Example video:

4) Search by reference (SHIFT + F12)

People should know about this feature since in VSCode it is implemented in such a way that it makes searching for references very fast. If you hit the shortcut on a symbol you will get a "popup" that, not only displays all the places the symbol is used, but also shows you a ~15 line snippet of how it is used so you don't have to actually go to the file and check if that is the reference you want.

We are using Visual Studio 2013 and not having this feature on the backend slows us down quite a lot. This is one feature that makes VSCode feel like an ease to work with.

Example video:

End

  • Have you found these useful? Try using at least one of the ones you didn't know about, it is going to improve your productivity a bunch!
  • Are there some features I missed related to searching?
  • Is there a feature that VSCode missed implementing related to searching?

Discussion

pic
Editor guide