LSP icon indicating copy to clipboard operation
LSP copied to clipboard

Diagnostic UI disappears after hover in some language servers [2.3.0]

Open MrFoxPro opened this issue 1 year ago • 6 comments

https://github.com/user-attachments/assets/bb0c793d-e463-4162-bdce-593c6327fccd

MrFoxPro avatar Dec 06 '24 19:12 MrFoxPro

As far as I can tell from the recording there seem to be 2 bugs:

  1. The language server sends textDocument/publishDiagnostics notifications 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.)

  2. 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).

jwortmann avatar Dec 06 '24 20:12 jwortmann

  1. The language server sends textDocument/publishDiagnostics notifications 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.

rchl avatar Dec 06 '24 21:12 rchl

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

jwortmann avatar Dec 06 '24 22:12 jwortmann

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

minerscale avatar Dec 09 '24 13:12 minerscale

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 avatar Dec 09 '24 13:12 rchl

@rchl, worked a charm thank you very much!

minerscale avatar Dec 09 '24 15:12 minerscale

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).

rchl avatar Sep 03 '25 19:09 rchl