16

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?

3
  • Improve the search performance and create a pull request for it on GitHub ;-) Now seriously: Search performance is a matter in VSCode and it has improved over the time. Unfortunately it is still not as fast as other editors and IDEs. From a user's point of view you can only vote for improving the file search. It's a planned item for November and December updates as you can see here: github.com/Microsoft/vscode/issues/15384 Commented Nov 15, 2016 at 14:40
  • 1
    March 2019 and this problem is still not solved. Why not have a look at Notepad++? The search through files is very fast. And it is open source: github.com/notepad-plus-plus Commented Mar 18, 2019 at 14:02
  • Currently to speed up search vscode recommends adding to the search.exclude. The files.exclude will remove the ide recognition entirely in the explorer. Commented Aug 19, 2021 at 18:21

1 Answer 1

17

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 }, 
Sign up to request clarification or add additional context in comments.

7 Comments

where is the settings file?
Ctrl+, (control and comma key) ... or (on windows) go to "File" > "Preferences" > "Settings" in the top menu and then on the settings page search for "search", scroll a bit to find a section called "Search: Exclude"
Also, take notice there is a Clog icon in the search siderbar inside "files to exclude" field. If that's not active, your .exclude settings will be ignored.
Currently to speed up search vscode recommends adding to the search.exclude. The one you have mentioned files.exclude will remove them from the ide recognition entirely in the explorer.
They should use a search cache like IntellijIDEA, Searching thousand of files in less than 1 minute.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.