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 not cleared on file close when workspace diagnostics enabled

See original GitHub issue

This 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:closed
  • Created a year ago
  • Reactions:2
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pisvcommented, Sep 5, 2022

@dbaeumer Thank you for the clarification!

1reaction
dbaeumercommented, Sep 5, 2022

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.

Read more comments on GitHub >

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

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