Vscode: Clear all problems in the 'Problems' pane with a button

Created on 23 Jan 2019  ยท  55Comments  ยท  Source: microsoft/vscode

Please add a button in the Problems pane that allows the developer to clear all items in there.

Following discussions from #15524, #29169, #66343 and #50448.

Currently we see problems from different sources (linters, tasks, etc) and they sometimes stay there after the problem or the source file is gone, e.g. problems in an unsaved buffer, in files that were renamed, or files removed when we switch Git branches.

More often than not I have a bunch of problems and the only way to clear that pane is to restart the entire editor.

error-list feature-request languages-diagnostics

Most helpful comment

80419 is a great example of why this issue is so frustrating. The file creates a problem which is not removed when the file is closed. The argument that it is always that it's up to the extension providers to clear up their problems is a bit moot when the main application itself can't even do it,

Please please please can we just have a button to clear them!

All 55 comments

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

Please do NOT close this again @sandy081

(FYI @atishpatel @meshula @pmunin)

As I mentioned in other issues, this is an issue with those extensions generating problems. They own the lifecycle of problems and they are responsible for clearing them when become stale.

Looks like VS Code has to fix this as extensions are not. So here is my proposal:

  • Problems view by default does not show problems of a file that is not known to VS Code. It means if a file does not exist and is not opened in VS Code, Problems view will filter them.

I am worried to introduce a clear button because this causes repercussions like introducing API changes etc.,

I don't think that will work - for example, my problems are generated from a cmake build running as a task - I wouldn't expect to have to open any files that have compilation errors.

If you would prefer not to add a button, or change the API, maybe just adding a command which destroys the problems window and recreates it would be enough?

@sandy081

As I mentioned in other issues, this is an issue with those extensions generating problems.

Yes. The issue is an issue from the extensions. But, adding this simple feature allows the users to have a much better experience.

Problems view by default does not show problems of a file that is not known to VS Code.

The filter probably isn't a great idea. Plus, if you add a filter, there will need to be a way to disable it and it doesn't catch all the cases.

I am worried to introduce a clear button because this causes repercussions like introducing API changes etc.,

Could you please explain more specifically why introducing a clear button would cause issues? The reason I ask is that there might be a difference between what you are imagining and what we are.
I don't think we need to overengineer this. Since the problems list can be repopulated by running the linters again, a clear button (or command) that would clear the problems list shouldn't require much.

With respect :pray:

The issue isn't even just about extensions, it is not perfect problem matchers as well (and for some cases, e.g. webpack it isn't even possible to get a PM that works in all cases) -- so having a clear would be a great addition imo.

Problems view by default does not show problems of a file that is not known to VS Code. It means if a file does not exist and is not opened in VS Code, Problems view will filter them.

I don't agree with this. The lingering errors aren't always about files that have been deleted since the last check. Sometimes the extension doesn't get executed again so the results are stale, etc. etc.

Perhaps the clear could be a forced re-run of the extension? I'm not sure if this is a good idea, thoughts?

If there are "magic" extensions that the Problems pane is expected to interact with in a special way, and "non-magic" operations such as output from linters that are not deeply aware of VSCode architecture that cause the Problems pane to irrevocably and incrementally fill with garbage, perhaps there's a fundamental design problem here, and the "non-magic" operations need to yield be routed to a new, less opinionated panel with a Clear button.

Clearing problems is not as straight forward as it is. @dbaeumer mentioned why exactly it is here

In VS Code problem model problems are owned by the one creating them. An extension could therefore always only apply the delta (e.g.remove one and add another one) instead of always computing all errors and pushing them into the model (the task system by the way does some delta optimizations as well). So if a user clears all problems he might miss out on new problems even if he changes files since the extension computing them might still think old problems are present (for example during incremental builds).

So, this needs introducing API(s) for changing problems and this has to be adopted by the problems owners.

I don't understand @sandy081 , the ones we are clearing are the ones we never want to see again; the extension has long forgotten about them, that's why they are getting stuck.

since the extension computing them might still think old problems are present

The extension doesn't think anything at this point, the stale items have been forgotten about, the deltas are not reflecting them any more. What's wrong with removing the stale items that the extension isn't maintaining any more?

So if a user clears all problems he might miss out on new problems

If the extension is sending deltas, this is actually impossible as new problems will be added to deltas. How could we miss new items?

@sandy081
Ah, thank you for quoting that. It helps us understand and focus on potential solutions.

A couple of questions:

  1. As adam-ah said, why wouldn't extension know the deltas is all problems? Are the deltas stored by the extensions instead of by vscode?
  2. One option is to introduce an API change that notifies the extensions, but there are other options. I'm currently solving the problem by using the "Reload window" command. What if the button cleared the list AND restart extensions that contributed to the problems list? This would allow for no delta issues and in turn, no missing out on problems. Is there a reason why this can't be done or why the solution is bad?

@adam-ah If a clear action is introduced, then it cannot be specific/scoped to stale problems. A stale problem can be anything in the given context. It can be from the deleted file, or from a task which did not update on fixing the problem. My point is that, clear action cannot be half complete and it should work for all problems including those which behave correctly. It means that extensions that are playing well and smart (incremental) should be aware of problems being removed.

If the extension is sending deltas, this is actually impossible as new problems will be added to deltas. How could we miss new items?

It is not just about missing it is also VS Code and extensions will be out of sync. This is not a good design and is error prone.

What if the button cleared the list AND restart extensions that contributed to the problems list? This would allow for no delta issues and in turn, no missing out on problems. Is there a reason why this can't be done or why the solution is bad?

It is not good to restart an extension to just reset the problems. An extension can be contributing more in addition to problems. This should be called restart extension instead of clear problems ๐Ÿ˜„ . Anyways restarting a running extension without window reload is not possible due to code loading and unloading. This is a separate topic and let's not deviate. If clear button is needed, it has to be done the right way with API.

Hahaha :laughing: Yeah, it's not an ideal solution, but it's about what I do to solve it currently with "Reload window". :)

So, where do we stand? There have been 5 issues opened with multiple people commenting and the proposed filter solution won't work in many cases. What more would it take to decide if a proper solution with an API change should be implemented? Or should we just live with the reload window?

If clear button is what it is needed, then we need to take the right path.

Facing this now with Git History plugin. When I view a git history, issues appear in Problem view. And, no way to clear these. A Clear button would be nice. Most IDEs do this.

A good example of why this is needed - I currently have 5 problems coming from vscode's settings.json file which is no longer open, meaning I'll need to reload the window to clear them.

If vscode can't clear up it's own problems, how can it reasonably expect extensions to do it?

@Gruntfuggly It is a bug, can you please file a separate issue providing steps to repro.

I've raised one, but the bug isn't really the issue...

Any update on this one?
It appears that users say we need a clear button, but @sandy081 says "we need to take the right path".
What is the right path and when could we get this released?

Right path is to introduce an API for problems removal and let the extensions to adopt to it. As of release, not yet planned.

Nothing wrong with an API, but it doesn't make sense to not have a Clear button. I think as users we are concerned with practical aspects of usage, i.e. having a window not cluttered with useless junk, rather than semantic correctness on the part of extension authors we have no control over.

Can't wait for appropriate API to come. For now, I've implemented a whole separate extension to run webpack and show errors in a separate treeview, which is such an overkill...

_(Not sure whether this or #50448 or some other item is the correct place for this comment)_

_Current workaround: command "Developer: Reload Window"_

Another use case for such a "Clear problem(s)" button or command is this:

The extension "salesforce.salesforcedx-vscode" enables a command and a context-menu command "SFDX: Deploy This Source to Org". You can use the command from the Explorer window/pane without even having a file open. If the deployment fails, a "Problem" line will be created. It will go away if you can successfully use that command to deploy that same file, but that isn't always desirable. The current work-around is to do the "Developer: Reload Window" command. But that's quite drastic.

Count me among the people who think a user should be able to clear the "Problems" view/pane like the Output, Debug Console, and Terminal views/panes can be cleared/killed. I did read @sandy081 / @dbaeumer 's comment(s) why "Clearing problems is not as straight forward", and I still feel (subjectively and perhaps naively) that ultimately, a consistent experience across the views/panes is better. If the problems did not go away upon the "Developer: Reload Window" command, then I might feel differently. But they do.

@jon-freed my guess is that "Developer: Reload Window" is akin to you exiting from VSCode and restarting it, so I'm not surprised it clears the problems. I suggest you lobby the developers of "salesforce.salesforcedx-vscode" extension to get them to add an extra command "SFDX: Clear Problems". It's their extension that owns the Problem entries you want rid of.

@gjsjohnmurray, we already have been through this with the conclusion that it's not feasible to fix every developer's plugins, but it is reasonable to fix VSCode.

@adam-ah as I understand what @sandy081 is proposing the VSCode team does (I'm not part of that team), extensions might still have to be updated to consent to having their problem items deleted wholesale by the workbench when the user clicks the button.

What if you just ask the user for consent? :) I mean the user's agency is to attempt to clear useless messages, irrespective of whether some extension is implemented correctly. This issue has driven my cmake dev/iteration cycles outside of vscode. Happily VS2019's cmake integration did show up in time to help out on that front, but it doesn't really solve the problem.

I get this every time I switch between branches, moreover, switching creates more problems as the files from the old branch don't exist.

@sandy081: To possibly cut through the issue:

The "Clear" button we (all) want (and which is there everywhere, in every tool, basically, but I really don't think I need to make the case stronger for this :) ) would not delete "the problems" themselves, only those unwanted messages, about the problems!

When clicking that "Clear" button, we don't actually want to delete "the problems themselves".
In our actual "problem model", we know that problems will not magically disappear that way, all we want is to just remove the irrelevant clutter (so that we can continue working on (possibly those same) real problems).

IOW: the error messages in the panel are not the problems themselves. The messages should be decoupled from the problem objects.

(This way VSCode can keep its own problem model the way it wishes, while it would let us not be bothered with it. And if an extension wants to update those problems, new/updated message can still reappear, I guess.)

_(BTW, this decoupling is actually the implicit reason, why other tools refer to that panel (i.e. its contents) as (error) "messages", not "problems", which I, for one, found a bit strange, when I first saw in Code. Nevertheless, it may well be an advanced concept actually, as other tools don't usually model those problems (at least not as comprehensively). They provide messages only -- and that's pretty much all we normally need. Code should also do that, as a minimum, plus it may do advanced problem modelling, too. But doing advanced modelling instead of the usual message handling is a net loss to users, which explains the strong need for this (can't emphasize enough: ubiquitous, kinda "standard") feature.)_

@adam-ah as I understand what @sandy081 is proposing the VSCode team does (I'm not part of that team), extensions might still have to be updated to consent to having their problem items deleted wholesale by the workbench when the user clicks the button.

but we're not asking for it to magically clear the problem. All we want is a way to declutter the problems list.

80419 is a great example of why this issue is so frustrating. The file creates a problem which is not removed when the file is closed. The argument that it is always that it's up to the extension providers to clear up their problems is a bit moot when the main application itself can't even do it,

Please please please can we just have a button to clear them!

I also felt frustrated, but in my case, using "Filter box" at the right to filter out messages by path pattern did solve my problem. Just my 2c.

It would be great to have a clear button. But here the issue seems similar to twitter fight for an edit button ๐Ÿ˜…

The issue I have is that it seems as though the problems don't clear out properly in the first place. For example, when I create a .soql file, I usually start with .sql so I can be notified of the usual sql errors, but I switch back to .soql when I save so it's not flagging things like "NEXT_N_DAYS" that _are_ supported by .soql and not .sql.

The issue for me is that the sql problems persist even after I've changed the file type to .soql. The only way to clear it now is to close VSCode and launch it again. This is my workflow until vscode gives me a way to clear the problems or Salesforce creates a language mode for SOQL.

Now vscode has an problem filter option: "Show activate file only". If the problem filter has an option like "show task problem matcher only", that would be great and enough for me.

:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Is vscodebot taking the mickey? :rofl:

For those waiting for a feature like this โ€“ please take a look at https://github.com/microsoft/vscode/issues/51103 โ€“ adding support for filtering problems by the extension which generated them.

If you're trying to temporarily ignore issues generated by noisy extensions like spell checkers, formatting extensions, etc. (e.g. especially when working on a quick patch for an open source project) that feature might be what you're looking for.

It just needs a few more ๐Ÿ‘s to get into the backlog.

This is easily reproduced.
Open a powershell file with errors in it and close it.
Open another ps1 with no errors.
All the previous errors are still in the problems pane.
it's clutter! Don't need it. My mind is already cluttered with junk.
WTF!!!

@gudtogo21 it sounds like the extension which reports the problems is forgetting to hook up the file close event and then remove its Diagnostic items. See https://github.com/microsoft/vscode/issues/93719#issuecomment-606054972

This is why we all want a magic clear button. It's not within our power to fix Powershell, and other extensions on the vendor's behalf, regardless on who has the moral high ground on this issue. In the mean time, we, the users, stare at clutter, with our own messages hiding in the swamp, and wish for a clear button.

I agree with this.

This is why we all want a magic clear button. It's not within our power to fix Powershell, and other extensions on the vendor's behalf, regardless on who has the moral high ground on this issue. In the mean time, we, the users, stare at clutter, with our own messages hiding in the swamp, and wish for a clear button.

Regardless of whose responsibility it _should_ be to clear out the pane, the user _should_ be able to decide when they've read and acknowledged the problem to their own satisfaction, and clear the pane themselves. Sure, extension authors should be responsible for cleaning up after themselves, but they're not doing it. Why should the users suffer when it should actually be in their control to clear that pane?

I agree that it's not the highest priority issue, but constantly passing the buck and essentially saying, "Sorry. Not our problem. Contact the extension author." I'm not _purposely_ trying to ruffle anyone's feathers, but that seems like a bit of a cop out to me. ๐Ÿคทโ€โ™‚

Thanks for the reply gjsjohnmurray.
Suppose you are right.
I'm using VSC to program Windows PowerShell, using PowerShell extension 2020.3.0 developed by Microsoft..
No other extensions... all messages are from PowerShell.
Cheers.

I'm waiting for it too
Add-ons sometimes cannot refresh their notifications from the Problems tab
This option will partially fix this situation

all my "problems" are from whatever comes in default for css checking and im getting a bit tired of closing and reopening my workspace to clear them out. >_>

should i have empty rulesets? probably not. do i care? not after i close the file.

Came here looking for a fix only to find that users have been asking for this for nearly 2 years.
I don't care whose responsibility it should be to clean up items in the problems window, I just want a way to clear whatever crap may be lingering there (for whatever reason, bug in the extension, deleted file, changed git branch).

Just let me clear the window, legitimate problems will reappear the next time I trigger the linter.

+1 !

Has any progress been done towards this? I see many people have such problems https://github.com/rust-analyzer/rust-analyzer/issues/5446 https://github.com/vshaxe/vshaxe/issues/132 etc., but no progress has been made here in a very long time.

Sadly, I feel this issue will end up the same as this one: https://github.com/microsoft/vscode/issues/15178 ๐Ÿ˜ž

I can't believe after this being constantly requested for so many years. They still haven't done anything and are being so stubborn about it. It just makes the developers look really bad.

I was going to donate x% of profit from every project completed with visual studio code to the developers but seeing how stuborn they are with a much requested feature. I think I'd rather not thanks.

I can't imagine that negative messages will motivate anyone. I'm also missing the feature to be able to clear the problem list.

VS Code comes for free. After ten years of using SublimeText I switched to Code approx a year ago and I'm really impressed
how much it evolved since then.

I'm developing an extension and it does not seem like the diagnostics.clear() is reliable. Sometimes it works to remove all diagnostics, sometimes it doesn't... Maybe the correct thing is the dispose the collection and recreate it every time a build is run? Could this be part of the root problem? Also agree a simple command would be good (but it is a hack).

I was going to donate x% of profit from every project completed with visual studio code to the developers but seeing how stuborn they are with a much requested feature. I think I'd rather not thanks.

@mttindustries I suggest to keep the x% and instead of donating the money get a developer paid with this money and let him create a fix for that feature. As it is in the backlog milestone a PR has a very high chance to be merged - there's just no one that did the work, donating developer time directly always helps most.

I have an issue with the jest test runner pollutes the problems panel. at startup those tests run again. it would be great to be able to clear this panel to see just compiler errors.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philipgiuliani picture philipgiuliani  ยท  3Comments

lukehoban picture lukehoban  ยท  3Comments

shanalikhan picture shanalikhan  ยท  3Comments

NikosEfthias picture NikosEfthias  ยท  3Comments

curtw picture curtw  ยท  3Comments