Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
MrFoxPro opened this issue Dec 6, 2024 · 6 comments
Open
Labels
language server issue Issues related to language servers communicating with this plugin

Comments

@MrFoxPro
Copy link

MrFoxPro commented Dec 6, 2024

sublime.mp4
@jwortmann
Copy link
Member

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 04827c7 (it's a side effect from requesting code actions on hover).

@rchl
Copy link
Member

rchl commented Dec 6, 2024

  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.

@jwortmann
Copy link
Member

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 microsoft/language-server-protocol#1743 (comment)

@minerscale
Copy link

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

@rchl
Copy link
Member

rchl commented Dec 9, 2024

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)

@minerscale
Copy link

@rchl, worked a charm thank you very much!

@jwortmann jwortmann added the language server issue Issues related to language servers communicating with this plugin label Dec 19, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
language server issue Issues related to language servers communicating with this plugin
Projects
None yet
Development

No branches or pull requests

4 participants