I use VS Code 1.99.2 and Oracle SQL Developer Extension for VSCode 24.4.1.
When I open stored objects from the CONNECTION
browser with syntax errors, these errors are shown in the PROBLEMS
panel. That's good. However, when I close the related editors, the PROBLEMS
panel still shows errors of editors that are not open anymore. This is confusing.
Here's an example of the unwanted behaviour:

And here's the related process as GIF:

IMO SQLDev's language server is pushing diagnostics to the VS Code client on didOpen
and didChange
. The language server is clearing the diagnostics on didClose
. Unfortunately, the didClose
notification is sent delayed to the language server. As a result, the update of the PROBLEMS
panel also happens delayed (usually after 5 minutes).
The bad news is that this is not a bug of the VS Code implementation and therefore will not be fixed.
The good news is that it's easy to fix. Instead of pushing diagnostics to the language server client, let the language server client pull the diagnostics. In this case, VS Code manages the lifecycle of the diagnostics. And it does it correctly. I know it because I had the same issues with my dbLinter extension. This link helped me understand the problem and implement the pull-diagnostics-approach:
I had to register the capability and implement textDocument/diagnostic. The change was surprisingly easy.
I hope the SQLDev team will switch to the pull-diagnostics approach in one of the coming versions.
Thanks.