4

Even with the default configuration, I still get tons of results in various node_modules folders when doing a workspace search.

Default setting:

"search.excludeFolders": [
        ".git",
        "node_modules",
        "bower_components"
    ],

I've even tried copying to my user settings and changing to several variants, such as "/node_modules", "/node_modules/", etc.

I've already seen the other post in vscode about this issue: How can I choose folders to be ignored during search? . This answer doesn't solve my issue.

I'm using Version 0.1.0 on OS X (commit d13afe1). Any chance there's a bug with exclude folders?

Community
  • 1
  • 1
  • I'm using 0.1.0 on OSX too. I can't replicate the issue you're having. For example, I have a 'public' folder, when I add 'public' to the excludeFolders array, both full-text search results and CMD+E (goto file) results are omitted for any file existing in public. – romiem Apr 30 '15 at 17:48
  • Possible duplicate of [How can I choose folders to be ignored during search?](http://stackoverflow.com/questions/29971600/how-can-i-choose-folders-to-be-ignored-during-search) – nwinkler Nov 27 '15 at 12:01

2 Answers2

3

After reading again your question and trying it out, only now I notice that the search.excludeFolders values apply only to the workspace root. So, for a node_modules folder in your hierarchy, you would need to use:

{
    "search.excludeFolders": [
        ".git",
        "node_modules",
        "bower_components",
        "path/to/node_modules"
    ]
}
Alex Dima
  • 21,891
  • 1
  • 15
  • 14
2

These preferences appear to have changed since @alex-dima's answer.

App -> Preferences -> User/Workspace Settings

You can choose custom settings that will apply to searches. For example, I am developing an EmberJS application which saves thousands of files under the tmp directory.

Picture of search before updating settings. Picture of search before updating settings.]

After updating the Visual Studio 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.

The search results are exactly what I want.

Picture of search after updating settings. Picture of search after updating settings.

Shotty
  • 12,307
  • 2
  • 13
  • 5