Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast search in Visual Studio Code

I've been wanting to move from PhpStorm to VS code, but one of the things I don't like about VS Code is how slow its built-in Search feature is at finding text within the files of a large project.

PhpStorm is really good for this and, for me, is an essential feature. I can understand that PhpStorm is good at this because it is indexing all the files in the project beforehand.

Is there any way I can make VS Code search faster?

like image 671
MakkyNZ Avatar asked Nov 15 '16 14:11

MakkyNZ


1 Answers

It may be as simple as telling VS Code not to index / search certain folders. Are there /vendor or /dist folders that you don't want to search through? Try this:

  • Do one of your slow searches
  • Look through the files that get returned
  • See if there are files being returned in a folder you don't care about

For each of these folders, add them to the files.exclude section of your settings file:

"files.exclude": {
  "**/dist*": true,
  "**/node_modules*": true
},

If there are any really large files that show up in the search, add those too.

The fewer files the search needs to deal with, the faster it will go.

Update Oct 2021

You should now use search.exclude instead of files.exclude, as files.exclude will remove the files from search, but will also remove the files from your file tree in the leftnav. search.exclude only filters them out of search.

"search.exclude": {
  "**/dist*": true,
  "**/node_modules*": true
},
like image 120
Dan Caddigan Avatar answered Oct 23 '22 13:10

Dan Caddigan