unional
unional

Reputation: 15599

How to exclude folders from search except a few?

I work on a large project with many files. I want to exclude as many files as possible.

I want to exclude **/node_modules, but except a few that are created by my company. e.g. **/node_modules/@mycomp.

Is it possible today in vscode 1.8.1?

Thanks,

Unional

Upvotes: 1

Views: 1529

Answers (1)

javiercbk
javiercbk

Reputation: 470

Here is what I did to only show the node_modules/swagger-tools folder.

In the .vscode/settings.json file I wrote the following rules:

  1. Filter all folders starting with the dot character or every letter except s.
  2. Filter all folders starting with s and is followed by every letter except w.
  3. Filter every folder starting with swagger- (at this point all the remaining folders started with swagger-) and is followed by every letter except t.

So the file ended up like this:

{
    "files.exclude": {
      "node_modules/[abcdefghijklmnopqrtuvwxyz.]*": true,
      "node_modules/s[abcdefghijklmnopqrstuvxyz]*": true,
      "node_modules/swagger-[abcdefghijklmnopqrsuvwxyz]*": true,
    }
}

Arguably is not the nicest thing to do but certainly does the trick.

Upvotes: 1

Related Questions