LSP
LSP copied to clipboard
Diagnostic UI disappears after hover in some language servers [2.3.0]
https://github.com/user-attachments/assets/bb0c793d-e463-4162-bdce-593c6327fccd
As far as I can tell from the recording there seem to be 2 bugs:
-
The language server sends
textDocument/publishDiagnosticsnotifications even though it opts into the pull diagnostics model. This is a bug in the server. This client currently just overrides diagnostics for a file with those which came last, and here the server seems to respond with empty diagnostics for the pull diagnostics requests. That is why they disappear. (There is a related bug in this client that multiple diagnostic streams are not handled correctly, but I think this matter has no effects here.) -
Pull diagnostics are requested on hover even though that shouldn't be necessary. This looks like a regression from https://github.com/sublimelsp/LSP/commit/04827c78d04cc6f055e8e061a6e3c8a6c1b882c3 (it's a side effect from requesting code actions on hover).
- The language server sends
textDocument/publishDiagnosticsnotifications even though it opts into the pull diagnostics model.
I wonder... does the spec imply or specify that it's not allowed?
2. Pull diagnostics are requested on hover even though that shouldn't be necessary. This looks like a regression from 04827c7 (it's a side effect from requesting code actions on hover).
I suppose we could avoid sending the request if there were no document changes since last time those were pulled. But then we'd need to store that version alongside the results.
I wonder... does the spec imply or specify that it's not allowed?
I couldn't find it explicitly in the specs, but I took it from the last paragraph in https://github.com/microsoft/language-server-protocol/issues/1743#issuecomment-1584057181
I just want to add that this bug renders rust-analyzer nigh unusable so I think it's prudent for the solution for this issue to end up as a hotfix
A workaround for now could be to add this to LSP-rust-analyzer settings file:
// Settings in here override those in "LSP-rust-analyzer/LSP-rust-analyzer.sublime-settings"
{
// ...
"disabled_capabilities": {
"diagnosticProvider": true,
}
}
I don't think that would even degrade any functionality (assuming that pull diagnostics functionality is not utilized properly)
@rchl, worked a charm thank you very much!
https://github.com/sublimelsp/LSP/releases/tag/4070-2.5.0 also includes a fix for:
2. Pull diagnostics are requested on hover even though that shouldn't be necessary. This looks like a regression from 04827c7 (it's a side effect from requesting code actions on hover).