Skip to content

Do not announce diagnostic_provider capability #86

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

Merged
merged 1 commit into from
Jul 1, 2025

Conversation

vitallium
Copy link
Contributor

The diagnostic_provider capability should be announced when a language server supports pull mode for diagnostics.

Announcing this capability informs the client that it can pull diagnostics for a document, which helps handle failed requests.
For example, in Zed, which supports pull mode for diagnostics, you might see the following error messages:

2025-06-27T19:46:31+02:00 ERROR [editor] Failed to update project diagnostics: pulling diagnostics: Get diagnostics via codebook failed: Method not found
2025-06-27T19:46:31+02:00 WARN  [project::lsp_store] Get diagnostics via codebook failed: Method not found
2025-06-27T19:46:31+02:00 ERROR [editor] Failed to update project diagnostics: pulling diagnostics: Get diagnostics via codebook failed: Method not found

I think it would be good to stop declaring the unsupported capability but I'm happy to discuss this further if needed. Thanks!

The `diagnostic_provider` capability should be
announced when a language server supports
the pull-mode for diagnostics.
@the-mikedavis
Copy link

For some more context: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics

On the server side setting diagnosticProvider (confusingly) declares to the client that a server supports pull diagnostics. It's unrelated to conventional push diagnostics (textDocument/publishDiagnostics notification).

@blopker
Copy link
Owner

blopker commented Jun 27, 2025

Makes sense, thanks for pointing this out. I had not seen this error.

Question, would it be worthwhile to implement this in Codebook? I'm a bit hazy on when this would be useful.

@the-mikedavis
Copy link

I've been looking into this part of the spec to add it to Helix and I'm confused by the motivation too 😄. Best I can tell, it's useful in a case where you modify multiple documents at once (say, rename a function) and you want to give a hint to the language server which document(s) should be prioritized based on which ones are shown in the UI. It's up to the client though to request diagnostics for visible documents. In contrast I believe Neovim has a minimal implementation which requests on textDocument/didOpen and textDocument/didChange - kind of mirroring regular push diagnostics.

And on the server side I know that rust-analyzer implements this part of the spec in a somewhat complicated way. It sends any diagnostics it computes itself for diagnostic pull requests and then sends rustc diagnostics as push diagnostics, presumably because its own diagnostics are much cheaper to compute.

On the server side it's totally optional and IMO is more effort than it's worth. It's becoming mandatory to implement for clients because some servers use pull diagnostics exclusively now.

@blopker blopker merged commit 85c018f into blopker:main Jul 1, 2025
9 checks passed
@blopker
Copy link
Owner

blopker commented Jul 1, 2025

Sounds good! Merged for now, util it's clear this needs to be implemented. Thank you!

@blopker
Copy link
Owner

blopker commented Jul 3, 2025

This change has been released 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants