-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ruff server
: Support publish diagnostics as a fallback when pull diagnostics aren't supported
#11092
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for implementing it so quickly!
Unless it's already done, we'd need to clear the diagnostics for the document for on_close
event otherwise the diagnostics will remain in the "Problems" tab even after closing the file. Refer https://github.com/astral-sh/ruff-lsp/blob/187d7790be0783b9ac41ce025a724cf389bf575c/ruff_lsp/server.py#L459-L464
I think our old extension also had an option to pull diagnostics only on save. But I don't mind pushing this out until we're asked to build this (especially because we can't really support it when using pull diagnostics) |
@MichaReiser Are you referring to |
@dhruvmanila I've opened an issue (#11114) to solve the problem you mentioned earlier. |
As for the |
Summary
Fixes #11059
Several major editors don't support pull diagnostics, a method of sending diagnostics to the client that was introduced in version
0.3.17
of the specification. Until now,ruff server
has only used pull diagnostics, which resulted in diagnostics not being available on Neovim and Helix, which don't support pull diagnostics yet (though Neovim10.0
will have support for this).ruff server
will now utilize the older method of sending diagnostics, known as 'publish diagnostics', when pull diagnostics aren't supported by the client. This involves re-linting a document every time it is opened or modified, and then sending the diagnostics generated from that lint to the client via thetextDocument/publishDiagnostics
notification.Test Plan
The easiest way to test that this PR works is to check if diagnostics show up on Neovim
<=0.9
.