Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore folders/files in Problems view #22289

Closed
bravecobra opened this issue Mar 9, 2017 · 67 comments
Closed

Ignore folders/files in Problems view #22289

bravecobra opened this issue Mar 9, 2017 · 67 comments
Assignees
Labels
error-list Problems view feature-request Request for new features or functionality on-testplan
Milestone

Comments

@bravecobra
Copy link

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
@dbaeumer
Copy link
Member

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

@bravecobra
Copy link
Author

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.

@dbaeumer
Copy link
Member

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.

@bravecobra
Copy link
Author

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.

@sandy081 sandy081 added error-list Problems view feature-request Request for new features or functionality labels Apr 4, 2017
@sandy081 sandy081 added this to the Backlog milestone Apr 4, 2017
@mattiLeBlanc
Copy link

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

@proProbe
Copy link

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?

@cortopy
Copy link

cortopy commented Jun 10, 2017

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

@klis87
Copy link

klis87 commented Jun 13, 2017

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.

@atiris
Copy link

atiris commented Jun 18, 2017

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.

@coccyx
Copy link

coccyx commented Jun 20, 2017

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.

@bkbonner
Copy link

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.

@RandScullard
Copy link

I'm seeing this problem too. In my case, like #22289 (comment), 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?

@cabbiepete
Copy link

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.

@niemyjski
Copy link

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....

@nikolaycviv
Copy link

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?

@JustinWebb
Copy link

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

@phifa
Copy link

phifa commented Jul 19, 2017

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?

@bgarrant
Copy link

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

@bgarrant
Copy link

zignd/HTML-CSS-Class-Completion#64

@archae0pteryx
Copy link

archae0pteryx commented Aug 9, 2017

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.

@robv8r
Copy link

robv8r commented Sep 7, 2017

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.

@throrin19
Copy link

@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

@sandersann
Copy link

sandersann commented Sep 13, 2017

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 
}

}

@bravecobra
Copy link
Author

bravecobra commented Sep 14, 2017 via email

@sandy081
Copy link
Member

sandy081 commented Apr 11, 2018

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

@shankarramr
Copy link

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

@sandy081
Copy link
Member

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

@awarecan
Copy link

awarecan commented May 7, 2018

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

@sandy081
Copy link
Member

sandy081 commented May 8, 2018

@awarecan Is that in the file explorer?

@awarecan
Copy link

awarecan commented May 8, 2018

Yes, in the explorer.

I am using version 1.23.0

@sandy081
Copy link
Member

sandy081 commented May 9, 2018

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

@lukepighetti
Copy link

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

@sandy081
Copy link
Member

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

@lukepighetti
Copy link

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

@sandy081
Copy link
Member

Highlighted in tree? Can you please paste the screenshot?

@awarecan
Copy link

I think @lukepighetti is talking the same issue with mine. Screenshot is here: #22289 (comment)

@lukepighetti
Copy link

That is correct!

@lukepighetti
Copy link

lukepighetti commented May 15, 2018

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

@awarecan
Copy link

awarecan commented May 15, 2018

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.

@sandy081
Copy link
Member

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

@nosTa1337
Copy link

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.

@lukepighetti
Copy link

lukepighetti commented May 17, 2018

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

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

@sandy081
Copy link
Member

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.

@sandy081
Copy link
Member

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

@microsoft microsoft locked as resolved and limited conversation to collaborators May 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
error-list Problems view feature-request Request for new features or functionality on-testplan
Projects
None yet
Development

No branches or pull requests