Right now when I use ⌘+O to search for files, the fuzzy matching appears to operate over all files in the current project. Unfortunately, this includes
Create a file with .gitignore & put the folder or file name which one you want to ignore.
to ignore everything below node_modules folder
echo node_modules/ > .gitignore
These preferences appear to have changed since @alex-dima's answer.
Changing settings
From menu choose: File -> Preferences -> Settings -> User/Workspace Settings. Filter default settings to search
.
You can modify the search.exclude
setting (copy from default setting to your user or workspace settings). That will apply only to searches. Note that settings from files.exclude
will be automatically applied.
If the settings don't work:
Make sure you dind't turn the search exclusion off. In the search area, expand the "files to exclude" input box and make sure that the gear icon is selected.
You might also need to Clear Editor History (See: https://github.com/Microsoft/vscode/issues/6502).
Example settings
For example, I am developing an EmberJS application which saves thousands of files under the tmp directory.
If you select WORKSPACE SETTINGS
on the right side of the search field, the search exclusion will only be applied to this particular project. And a corresponding .vscode
folder will be added to the root folder containing settings.json
.
This is my example settings:
{
// ...
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/bower_components": true,
"**/tmp": true
},
// ...
}
Note: Include a ** at the beginning of any search exclusion to cover the search term over any folders and sub-folders.
Picture of search before updating settings:
Before updating the settings the search results are a mess.
Picture of search after updating settings:
After updating the settings the search results are exactly what I want.
I'm an idiot so it took me a while to realize this, but make sure that the Gear icon is clicked on the global search so your settings can be applied.
Forget aboves for vscode exclude search pattern, try to below pattern it is working for any folder in vscode last version!
!../../../locales/*
for example i have searched like below vscode example clude settings
files to include: *.js
files to exclude: **/node_modules,!../../../locales/,!../../../theme/,!../../admin/client/*