question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document diagnostics report not used when text document closed

See original GitHub issue

Using language client 8.0.2-next.5. The server supports pull document diagnostics, but not workspace diagnostics.

The client (correctly) sends textDocument/diagnostic to pull a new report when a file is closed (i.e., is no longer managed). However, the returned report by the server is not then used by the client - the old diagnostics still remain.

In my case, I want to clear the diagnostics of some files when they are closed / no longer managed, but this does not happen.

Minimal example: https://github.com/JohnnyMorganz/pull-diagnostics-bug

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aeschlicommented, Jul 4, 2022

@JohnnyMorganz You should looking into using workspace diagnostics

  • Workspace diagnostics are shown for all resources, unless the ones open in an editor
  • Document diagnostics are shown for the resources in open editors. Your workspace diagnostics would not contain diagnostics for ignored resources, but the your document diagnostics would.
0reactions
JohnnyMorganzcommented, Jul 1, 2022

Understandable that the client should be controlling when it shows diagnostics. I guess my main ask would be is there any way of controlling this as a user, not necessarily as a server?

I feel like its quite important, as a user, that some diagnostics should be made available even when the file is closed (https://github.com/microsoft/vscode/issues/13953 shows the importance of this for js/ts), whilst other files can be ignored. It seems that this is something wanted by other servers too (https://github.com/microsoft/vscode-languageserver-node/issues/848#issuecomment-652858418), where there are cases for errors to only be shown whilst a file is open for some (not necessarily all) files

Maybe this is out of scope for this repository/issue though. Its probably also possible to control this once we implement workspace diagnostics, unless that is also not really recommended there.

EDIT: maybe this could be something configurable by a predicate in DiagnosticPullOptions on the client? e.g. as an extension to filter(document, mode), further including some sort of info about the state (open/closed)

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found