Vscode: Ignore folders/files in Problems view

Created on 9 Mar 2017  Â·  67Comments  Â·  Source: microsoft/vscode

The Problems View now lists all problems, even in 3rd party code like in node_modules, which is cluttering the actual problems of the opened project. You should be able to ignore certain folders/files while diagnosing/listing problems. This should be possible on a project basis, not as a VSCode setting. (thus in the .vscode/settings.json)

  • VSCode Version: 1.10.2
  • OS Version: Any
error-list feature-request on-testplan

Most helpful comment

I'm having same issue. I can't find how to configure in-built validators (css, html) to ignore folders like node_modules

All 67 comments

@bravecobra what is the source of the problem. Usually you can configure this with the tool that generates these problems. Is it ESLint, JS, ...

I think that's the problem. I have no idea which tool is generating the errors or where to configure them. My workspace is filled with projects in JavaScript, TypeScript, C#, SCSS, HTML, etc.. One of my sub-folders contains an angular 2 project, another one contains an ASP.NET website, some of them are javascript or plain html5/CSS. All of them using 3rd party dependecies through nuget, npm, bower,etc
There is no indication which tool is generating these problems and/or what configuration it is using.

  • I see linting on ESLint, TSLint, markdownlint (3 plugins I installed), which report that they could not be enabled since there is no config file in the root of the workspace (sure, it's in one of the subdirectories containing the project), but I do see warnings in typescript (which is not my code, but from a 3rd party test project)
  • Omnisharp is spitting out errors (like I should add mscorlib while being on Linux and Windows simultaneously ) and my projects compiles perfectly using the dotnet cli. Errors coming from the selenium-webdriver's test project which got in through npm as I'm using e2e on Angular. I'm sure this is an Omnisharp problem, not a VSCode one.
  • I see errors popping up on the minified css from bootstrap that got in through npm.
  • SCSS linting is happening as well (of which the settings are in vscode) and gives errors in files inside node_modules
  • Some problems also disappear when closing the file, others stay.

In other words, currently, the Problems view is no real added value to me as its behaviour "appears" random to me (I'm sure it is not). Without any indication of which tool/plugin/setting is generating the problem and where/how it can be configured, there is no way of ignoring/fixing 3rd party code. I'd be happy to configure each individual tool to ignore folders or files (if the tool provides that), but first I'd need to know which tool it is. Secondly, what if the tool itself doesn't provide such a feature and I choose to ignore the problem/warning (it might not be my own code), how would I make it disappear from the problems view? So the original question boils down to :

  1. Indicate which tool/plugin/vscode-setting is giving the error and where it can be configured
  2. If the tool doesn't provide a way for ignoring the error/warning, at least a way to ignore it, so it won't clutter your view on the actual problem of your own project code.

Echo problem should start with a [*] indication pointing to a tool that generated the problem. So [ts] means TypeScript, [js] means JavaScript, [eslint] means ESLint, ....

Does that help identifying the tool generating your problems.

That would identify them (maybe), but still that would not allow for uncluttering the view. For instance, the build-in validation (https://code.visualstudio.com/docs/languages/css) does not allow me to specify folders to ignore (the vendor folders like node_modules) on a project basis. Just an [*] indication would indeed point you to a tool, which "might" enable you to un-clutter, so that still doesn't solve my second remark at the end of my previous reply. Adding a "problem view filter" setting in the .vscode folder on a project basis would do that. Indicating that x number of problems were hidden due to this setting, might even help to find incorrect items added to the setting. Basically, I want to right-click in the problems view on "ignore this problem"or "ignore problems in this folder" or something alike. The indicator would indeed allow you to configure the tool correctly so it doesn't spit out these problems, but as I said, the tool might not be able to do so.
PS: Why do problems go away from the problems view once you close the file? I expect to see all the problems of "my" code (not the vendor's), not just the ones of the opened files, sort of like the Error's List in Visual Studio. This might be a separate issue.

Any solution for this? I am having a similar issue where I got problems reported from stuff in my node_modules folder.

My TSCONFIG

{
  "compilerOptions": {
    "outDir": "./dist/",
    "sourceMap": true,
    "noImplicitAny": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "target": "es5",
    "jsx": "react",
    "allowJs": true,
    "typeRoots": ["node_modules/@types/"],
    "types": [
      "node",
      "lodash",
      "angular"
    ]
  },
  "filesGlob": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "!node_modules/**"
  ]
}

Not sure how to tell VS CODe to ignore these problems. Lot's of them are about README.md lines in node_modules

Hello!
Im also running in to the problem of the built in css-linter shows error from the node_modules. Is it possible yet to set folders for it to ignore?

I'm having same issue. I can't find how to configure in-built validators (css, html) to ignore folders like node_modules

I have related problem with html linting problems in node_modules directory when using IntelliSense for CSS class names plugin. When I click button to cache all CSS classes to have intellisense of available CSS classes, this plugin scans all directories to find CSS classes. The problem is, that those scans trigger linter rules for all scanned files. So I always end up with 99+ problems showed in PROBLEMS tab. I managed to get rid of CSS, SASS, LESS problems by disabling those totally, but I cannot see any option to disable HTML linter. It would be great to add it. Also, it would be even greater to add option to exclude custom directories from build in linters for CSS, SASS, LESS and HTML.

for me, it shows "problems" from .history folder which contains temporary versions of files (so it really is not a problem for my code). But on first places in Problems tab I still see that some old version of app.component.ts - app.component_20170515154207.ts was for few seconds saved in incorrect state.

Problem text (I assumed it comes from tslint, but this directory is ignored in settings):
_[ts] Cannot find module './app-data'. (5, 33)_ ...

My settings already contains also this parts:

User settings

"files.exclude": {
  ...
  "**/.history": true
},
"files.watcherExclude": {
  ...
  "**/.history/**": true
},
"autoimport.filesToScan": "{src,e2e,node_modules}/**/*.{ts,tsx}",

Workspace settings

"tslint.exclude": ["**/dist/**", "**/.history/**", "**/node_modules/**"]

I do not know what else I could do anymore.

This has recently become a problem for me as well, now that vscode-go allows for building the entire workspace. This feature also builds all the vendor folders and reports problems on them, which I cannot easily fix from the go build tools. We need a top level filter pattern which allows us to ignore file patterns or even basic string matches of errors we'd like to ignore from a users perspective. There are no so many plugins which can generate problems that attempting to solve this at it's source puts an undue onus on the user to go track down settings when it could be a simple UX of _right-click->ignore this file_ or _right click->ignore pattern_.

if a problem indicates [css], it doesn't tell us which extension is generating the problem. It would be helpful to identify the source to be able to configure it.

I'm presuming that if I can identify the source then I can configure the source to ignore areas I'm not concerned with.

An ignore pattern option would be nice.....akin to throwing a sheet over the problems...out of sight, out of mind.

I'm seeing this problem too. In my case, like https://github.com/Microsoft/vscode/issues/22289#issuecomment-309287183, it's the .history folder reporting [ts] errors in the Problems view.

I have already excluded .history from both files.exclude in settings.json and exclude in tsconfig.json. I see that this issue is marked as a feature request, but isn't it a bug if errors are showing up from excluded folders?

Any chance that VSCode could be made to ignore everything in .gitignore (and similar files for version control systems) this is a great indicator of what code I am interested in.

I'm also seeing problems reported from files in node_modules. The worst part is I don't know what added the problem... If I don't know how it was reported, where do I start looking to fix it. Which addin etc....

I also have problems with node_modules as others state. It irks some files from that folder to have problems. How to ignore folders from scanning, like node_modules?

I've experienced the same issue. In my case, the Problems View is cluttered with warnings reported by Markdown on files in node_modules.

  • VSCode Version: 1.14.0

same problem, for me it is a folder with temporary created php files.
at the bottom it says more than 99 problems
how can i ignore this folder?

Same thing here. The node_modules folder is not being properly excluded even though it is in the files.exclude settings. The weird thing is it will start to work correctly again after I do some work on the site. It drops from 99+ to like 7 problems which is correct. The issue may be the IntelliSense for CSS class names plugin it seems. If I disable it things get better. https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion

Anyone made headway on this? I also disabled my html-css-class-completion and this got rid of 96+ "problems" this is obviously? an issue with that plugin? should we open an issue there. Just thinking outloud here.

I have the same issue with node_modules using VSCode 1.16.0 on Windows 10 version 1607. I resolved the issue by adding the following to my settings.json and then closing all instances of VS Code before reopening it.

{
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/node_modules": true
    }
}

After closing all instances of VS Code and reopening it, node_modules was no longer visible in the list of files and folders. Also, I no longer experienced warnings or errors from node_modules.

It's not enough to reload the window. You __MUST__ close all instances of VS Code. If you don't, the node_modules folder will no longer be visible, but the errors and warnings will still be present.

@robv8r Your solution works but this is not the good solution. Now, if I want check content of libs to understand them or search more informations, I can't do this

This solved it for me
https://stackoverflow.com/questions/33258543/how-can-i-exclude-a-directory-from-visual-studio-code-explore-tab

Go to File -> Preferences -> Settings (or on Mac Code -> Preferences -> Settings)
Pick 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 
}

}

Such would NOT solve it for me. I still want to be able to access
node_modules folder from the explore tab, I just don't want it to appear in
the problems tab, as that is code I cannot correct.

Any solution for this problem? I am also facing this problem.

@klis87 I was able to disable my HTML linting errors by adding "html.validate.scripts": false. There is also a "html.validate.styles" option. Not sure if any other kind of HTML linting errors are generated in Problems panel.

This does not solve the core problem, however. Would be a great feature to disable wasting CPU on linting node_modules.

Yep, I'm facing this as well...

@mliq thanks for this, was this added recently as I search for sth like this then?

Anyway, this is still not well enough. Instead of true false decision for built-in html, css, sass and less linters, it would be great to have include and exclude settings for each linter type.

This is a temp fix at best as I cant see all of my filed now which is not a good long term fix. We need a simple way to "exclude" files/folders from the linters.

{
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/node_modules": true
    }
}

I wanted to see node_modules in my files, but I wanted to ignore them by linter.
Right not it is not really obvious how it works.
I also have cordova folders, dist folder. I need to go there from vs code, but I do not need any linter inside of such folder.

Can we have option?:
{
"lint.exclude": {
"/node_modules/": true
}
}

Please add a linter exclude option. We all need this.

I hoped this would have been in 1.17. Maybe 1.18?

I would like to have problems.exclude option or problems.ignore since I use node_modules folder and wanted to see it. If I do not use files.exclude the problems tab becomes completely useless bcs of that all errors in node_modules.
The same with coverage folder. 😞

We need this VSC team.

One cause of the many diagnostics is the extension Intellisense for CSS extension.
It opens all CSS and HTML files in a workspace in a vscode.TextDocument. This triggers the CSS and HTML linters which then produce the errors/warnings. We will discuss this with the extension author in https://github.com/zignd/HTML-CSS-Class-Completion/issues/85. So an immediate fix is to disable this extension.

This doesn't explain the appearance of the markdown related errors as described in the comment above https://github.com/Microsoft/vscode/issues/22289#issuecomment-316236449. @JustinWebb what extensions do you have installed?

@egamma You are correct. If you remove that extension Intellisense for CSS extension then many of the problems no longer are shown

Hi VS Code Team, yours is a great product, but please; just add the ability to ignore a file in any process (whether it be extension or editor based). I have a separate notes.html file that I use as a todo, general stuff to remember... It's basically my notepad all in one. It causes hundreds of errors to display. No, I don't want to use notepad or something else with poor text highlighting / simpler editing abilities. No I shouldn't have to disable HTML linting to continue using your product the way I have every other. There are numerous use cases where a user will want to ignore files for whatever reason. Please add this capability.

Here too. In my project there is a webservice, which has to be built on .net (because it includes libraries that are not available for .net Core). Therefore vscode cannot handle it. But I am still developing my client-side part with typescript in vscode.

But the c# part is messing the "problems"-View up and makes it simply useless for me. ( > 517 errors). And now it is even more annoying, because everything where problems are found is now marked red. in the explorer-tab.

Excluding the files with files.exclude did not work, as c# files seems to be analyzed altough they are not even visible in the explorer view. (altough i still would prefer seeing having them accessible through the explorer anyway).

Pls provide a setting to exclude folders/files from the problem-view (or analyzer or however you want to call it)

+1

Has there been been some movement on this since October @sandy081?

In my specific case I get a "project.json is no longer supported" message relating to the old .NET Core project.json files every time I start up VSCode... all because there's a project.json nestled within a node_modules dependency.

@edew Unfortunately no.

@sandy081 OK mate, no need to drown me in the details.

In all seriousness thanks for VSCode, it's great. Hopefully this issue is resolved sooner rather than later. 👌

I would like to suggest another type of "exclusion". What about excluding warnings from showing up in the tree view and only allowing errors?

I am trying to exclude files from being checked because they show a huge amount of problems (over 1k). I need to ignore these files as the problems are false-positives. Those are config files that I still need to be able to see and edit, but I don't want them checked. I tried using
"files.watcherExclude": { "**/*_config*": true }
but nothing happens. The number of problems in the problems view is still the same. Any ideas? I'm using an extension PHP IntelliSense 2.2.9. Turning it off (obviously) solves the problem, but that's not an option.

This really needs to be resolved, it's getting pretty crazy that this is
still an issue.

Thanks
-Blake Niemyjski

On Thu, Mar 15, 2018 at 6:34 AM, Tonislav Atanasov <[email protected]

wrote:

I am trying to exclude files from being checked because they show a huge
amount of problems (over 1k). I need to ignore these files as the problems
are false-positives. Those are config files that I still need to be able to
see and edit, but I don't want them checked. I tried using
"files.watcherExclude": { "*/_config*": true }
but nothing happens. The number of problems in the problems view is still
the same. Any ideas? I'm using an extension PHP IntelliSense 2.2.9. Turning
it off (obviously) solves the problem, but that's not an option.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/22289#issuecomment-373346394,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA-So6EvQfI1VOpsHBknM-tyayTPkTfcks5telHRgaJpZM4MX9wp
.

Currently OmniSharp plugin do not respect files.exclude setting. Here is corresponding issue https://github.com/OmniSharp/omnisharp-vscode/issues/1694.

I have to say great editor and I'm a huge fan. However I'm having the same issue with v1.21 and the problems tab and PHP all stock. It is displaying problems from my PHP cache and these are starting to pile up. I have the following in my settings.json although still being displayed.

    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "var/cache/dev/*.php": true,
        "var/cache/prod/*.php": true
    },
    "files.watcherExclude": { "var/cache/dev/*.php": true,
    "var/cache/prod/*.php": true
    }

+1 it would be a pretty slick for an option to read the gitignore

+1, I have similar problem with Java project. Wish we can exclude folders from Problems View so that it is not cluttered. I have 1k problems listed in this view and most of them are from files that are 'legacy' to us and can be ignored.
Note: Ignoring folder in files.exclude or files.watcherExclude etc does not help.

You can now exclude folders/files in problems view using following filters

  • Use files exclude filter Action: Filters all folders/files matching files.exclude setting. This is multi-root aware.
  • Filter input box now accepts files include/exclude patterns.
  • Filters are retained per workspace.

kapture 2018-04-12 at 0 05 27

This will be available from tomorrow's insiders

Awesome! But the count badge shows the full count, which seems odd to me. But thanks!

Count badge shows total number of problems. Filtered count is shown in the badge in filter input box.

node_modules still displays as RED, after applied filter "!/node_modules/*/" in problems view, It really lets me feel uncomfortable
image
image

@awarecan Is that in the file explorer?

Yes, in the explorer.

I am using version 1.23.0

Filters in Problems view are view only filters. It will only exclude in Problems view.

How do we get the problems tab to ignore node_modules? Thanks

Using the exclude glob pattern: !**/node_modules/**

That does work, but the file is still highlighted in tree.

Highlighted in tree? Can you please paste the screenshot?

I think @lukepighetti is talking the same issue with mine. Screenshot is here: https://github.com/Microsoft/vscode/issues/22289#issuecomment-387240293

That is correct!

As a side note – ideally it would just ignore everything in .gitignore

I like to have a files.problemExclude in settings

Likes other comment in this issue, files.exclude will exclude the entire node_module folder from project explorer, which is not desired. I just do not want to see any problem in my node_module folder.

If no diagnostics/problems have to be generated for specific files, the corresponding extension should provide that feature.

I am using ionic and since last version of visual studio code (1.23.1) I am also receiving problems from platforms\android... java files which I need to ignore because they are not relevant.

@awarecan I agree, this is the best way to proceed.

files.problemExclude = ["node_modules", "foo", "bar"]

I think the right and efficient approach is to extensions provide options to exclude.

@awarecan Can you please check with the extension to provide the exclude option.

Since this issue is resolved, I am locking it. Please open new issues for new requirements/bugs.

Was this page helpful?
0 / 5 - 0 ratings