-
Notifications
You must be signed in to change notification settings - Fork 328
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
Document diagnostics report not used when text document closed #1013
Comments
@JohnnyMorganz thanks for the GitHub repository. I was able to reproduce this, however we need to think a little what the expected behavior would be in such a case. I opt to do the following:
@aeschli since you are using pull now as well any ideas / advice here? |
Thanks for checking it out!
For my use case, I only want to clear diagnostics for files which have explicitly been marked as "ignored". i.e., if a user opens an ignored file, we show diagnostics whilst its open (to highlight any problems), but then once they close it we remove the diagnostics so it no longer clutters their UI. For non-ignored files, I want to keep the diagnostics there as it may be useful to the user (e.g., type errors). For us, ignored-files are typically third party files which is why a user doesn't really need to see the diagnostics generally, but it may be helpful if they are trying to debug something. I do intend to personally switch to workspace diagnostics some time, but currently we don't have the infrastructure set up yet in our server to support it. I just wanted to point out my use case as it may be more worthwhile allowing the language server to control what should happen to the diagnostics, rather than blanketly clearing them. EDIT: another use case in mind is instead of clearing all diagnostics, a server may only want to show a subset that are of high importance once the file is closed. The client doesn't apply the diagnostics returned in the report in this case as well |
It is the client that decides when to show (or clear) diagnostics. VS Code only shows document diagnostics for documents that are open in an editor, but other editors might do this differently. The language server basically just replies to requests: Compute all diagnostics for a document content. That document might be open in an editor, but could also be a virtual document, used programmatically. |
I would basically implement the clear on the client side. Does that make sense to you @aeschli |
Understandable that the client should be controlling when it shows diagnostics. I feel like its quite important, as a user, that some diagnostics should be made available even when the file is closed (microsoft/vscode#13953 shows the importance of this for js/ts), whilst other files can be ignored. 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 |
@JohnnyMorganz You should looking into using workspace diagnostics
|
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
The text was updated successfully, but these errors were encountered: