Skip to content
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

Clearing existing diagnostics when a watched configuration file is modified #1594

Open
vinistock opened this issue Dec 13, 2024 · 2 comments
Labels
bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@vinistock
Copy link
Contributor

We implemented the following scenario in the Ruby LSP (PR):

  1. A user is modifying files. Diagnostics are served using pull diagnostics (textDocument/diagnostic)
  2. The user decides to change the configurations for the linter. This is done by editing .rubocop.yml
  3. We then reload the linter with the new configurations and clear the existing diagnostics, since they may no longer be valid

The flow of clearing the diagnostics is simply:

  1. The server receives a workspace/didChangeWatchedFiles notification including .rubocop.yml
  2. We fire textDocument/publishDiagnostics notifications with empty arrays to clear the diagnostics on all currently opened files

However, this does not seem to work. We use the same technique to clear diagnostics on textDocument/didClose and that works properly, but trying to clear the diagnostics when a watched file notification comes in doesn't do anything.

I tried debugging the code for vscode-languageclient to see if our notifications were being received and processed and everything seemed fine, but the diagnostics still won't go away.

Are we doing something incorrectly? Or is this a bug somewhere?

@dbaeumer
Copy link
Member

That should work that way. I use the same for ESLint

@dbaeumer dbaeumer added the bug Issue identified by VS Code Team member as probable bug label Dec 16, 2024
@dbaeumer dbaeumer added this to the Next milestone Dec 16, 2024
@vinistock
Copy link
Contributor Author

The fact that the client doesn't include the configuration file's extension as part of its document selector shouldn't matter, right? That is, the configuration file is YAML, but the client doesn't include YAML in the selector.

Do you have any tips for trying to debug this? It's easy for me to reproduce, so if you can point me to where the clearing of the diagnostics happen I can check what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants