Document diagnostics not cleared on file close when workspace diagnostics enabled
See original GitHub issueThis follows on from #1013, where it was fixed that document diagnostics are cleared when a file closed.
This works fine when a server does not support workspace diagnostics.
There, it was mentioned by @aeschli:
@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.
So I followed these steps. I implemented workspace diagnostics, and my workspace diagnostics do not follow include ignored resources - but document diagnostics do.
However, if I have workspace diagnostics enabled, the document diagnostics do not clear on file close.
I updated my pull diagnostics minimal repro (https://github.com/JohnnyMorganz/pull-diagnostics-bug) with the following diff:
diff --git a/server/src/server.ts b/server/src/server.ts
index 1069d4a..6a8646b 100644
--- a/server/src/server.ts
+++ b/server/src/server.ts
@@ -30,7 +30,7 @@ connection.onInitialize((params: InitializeParams) => {
textDocumentSync: TextDocumentSyncKind.Incremental,
diagnosticProvider: {
interFileDependencies: true,
- workspaceDiagnostics: false,
+ workspaceDiagnostics: true,
},
workspace: {
workspaceFolders: {
@@ -80,6 +80,12 @@ connection.languages.diagnostics.on((params) => {
};
});
+connection.languages.diagnostics.onWorkspace(() => {
+ return {
+ items: [],
+ };
+});
+
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:15 (5 by maintainers)
Top Results From Across the Web
List of Errors Are Not Cleared When I close SQL File · Issue #55345 ...
I have an sql file generated from sequelpro. Saved that file in my workspace. Open file from my workspace. Errors appear in status...
Read more >Diagnostic Logging Settings - VMware Docs
Diagnostic Logging Settings ... As an admin, you can choose logging levels for the different Workspace ONE UEM components. Based on the selected ......
Read more >Citrix Receiver Diagnostics Tool - For Windows
The Receiver Diagnostics Tool for Windows enables Administrators to collect and upload key data from various components of Citrix Receiver ...
Read more >Capture Google Drive for desktop logs for support
Open a command prompt: Press Windows+r. Click Run and then enter cmd and then press Enter. ... Reproduce the issue as quickly as...
Read more >Change Office Diagnostics settings - Microsoft Support
Change Office Diagnostics settings · Click the File tab. · Click Options. · Click Trust Center, click Trust Center Settings, and then click...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dbaeumer Thank you for the clarification!
The benefit comes with pull on documents. The old push model had no knowledge about which files to priorities. Hence it could easily happen that you saw stale errors for some time. The pull model allows to combine a long running pull with single document pulls hence knowing which once to prioritize.
The solution you implemented is in line with the specification. I will close the issue.