How can I exclude a directory from the Visual Studio Code "Explore" tab?

I am trying to exclude several folders on the Explore tab in Visual Studio Code. To do this, I added the following jsconfig.json to the root of my project:

{ "compilerOptions": { "target": "ES6" }, "exclude": [ "node_modules" ] } 

But the <node_modules folder is still displayed in the directory tree. What am I doing wrong? Are there any other options?

+76
visual-studio-code
Oct. 21 '15 at 11:49
source share
3 answers

Use files.exclude :

  • Go to File โ†’ Settings โ†’ Settings (or on Mac Code โ†’ Settings โ†’ Settings )
  • Select the workspace settings tab
  • Add this code to the settings.json file displayed on the right side:

     // Place your settings in this file to overwrite default and user settings. { "files.exclude": { "**/.git": true, // this is a default value "**/.DS_Store": true, // this is a default value "**/node_modules": true, // this excludes all folders // named "node_modules" from // the explore tree // alternative version "node_modules": true // this excludes the folder // only from the root of // your workspace } } 

If you select File โ†’ Settings โ†’ User Settings , then you will configure the exception folders globally for your current user.

+150
Oct 22 '15 at 9:33
source share

In new versions of VS Code, you go to the settings ( Ctrl + , ) and do not forget to select "Workspace Settings" in the upper right corner.

enter image description here

Then add the files.exclude parameter to specify patterns to exclude.

You can also add search.exclude if you only want to exclude the file from the search results, and not from the folder explorer.

+28
May 16 '17 at 1:56 pm
source share

I managed to remove the errors by disabling the checks:

 { "javascript.validate.enable": false, "html.validate.styles": false, "html.validate.scripts": false, "css.validate": false, "scss.validate": false } 

Obs: My project is a PWA using StyledComponents, React, Flow, Eslint and Prettier.

0
09 Oct '17 at 13:28
source share



All Articles