-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support textDocument/diagnostic specification (Pull diagnostics) #11315
base: master
Are you sure you want to change the base?
Conversation
…ll-diagnostics into unchanged_documents
…to pull-diagnostics
dbed6e4
to
13f048b
Compare
85600d2
to
29c5318
Compare
Thanks again for the reviews! The request is currently only being send on document changes, which makes a terrible user experience 😄 Is there a way to send this request when a document is opened, or should a workspace diagnostic event be send when the language server (which supports this feature) is started? Edit: By the way, i am using this branch daily for C# development, since it allows me to use the same language server as the C# vscode extension. So i am keeping the branch up to date with |
I did some experiments with this on roslyn language server. It might be that this language server just behaves weird (which it does on other stuff), but sending I also noticed that responses can either be a full or an related unchanged document report. At the moment, since we only listening on changes, we only get the full reports. This means that when i eg. rename something, i will not see diagnostics on related documents until i make a change. I am not sure if the specification suggest to pull diagnostics every time a document is viewed, or if we should pull diagnostics for all open documents on changes to a document. Edit: Pulling diagnostics for all open documents seems to work fine actually. |
I did some experiments with |
I started to implement workspace diagnostics, but the language servers that i use don't responds to this request. Eslint returns an error and roslyn returns an empty array. So not much to work with here. I also think that this will be difficult to get to work in helix, because we would need the diagnostics picker to await the async request before displaying, or we would need a way to refresh diagnostics in the picker when the request has finished. I got refresh diagnostics working though |
See helix-editor/helix#11506, until helix-editor/helix#11315 lands I have to stay on vscode-langservers-extracted 4.8.0 or older
Have you tried building a newer version of Microsoft/vscode-eslint? Since you referred to version |
No i have only tried But this would require some refactoring of the diagnostics picker, and i think it should be in a separate pull request |
See the symbol picker for an example of a picker that waits on an LSP request. The workspace symbol picker is maybe also a good example but it's a sort of "dynamic picker" that re-requests symbols as you type with follow-up requests to the language server. |
helix-term/src/application.rs
Outdated
@@ -735,9 +743,11 @@ impl Application { | |||
doc.text(), | |||
language_id, | |||
)); | |||
|
|||
helix_event::dispatch(helix_view::events::DocumentDidOpen { doc }); |
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.
Ideally we should only be dispatching the internal DocumentDidOpen when we initially open a buffer. Here instead of using DocumentDidOpen
we should be able to use pull_diagnostics_for_document
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.
Changed to use pull_diagnostics_for_document
directly
565f629
to
131f0b3
Compare
Okay it does not look that difficult. I have however not been able to get response from Edit: Okay i gave it a very low effort shot using this fork which has a nix flake i could use. I looked at the capability responses from the 3 language servers i know of that supports pull diagnostics: A workaround could be to request diagnostics for all open buffers, for all language servers which support pull diagnostics, before opening workspace diagnostics. I suggest to wait for language servers to support this capability, and maybe handle pulling diagnostics for all documents for workspace diagnostics picker in a separate pull request. |
Closes #7757, if workspace diagnostics is not a requirement. I have not yet found a language server which supports this capability.
Handling of response was originally done by @woojiq in #7900. I was not able to include their git history since their branch has been deleted.
Tested with language servers:
eslint
version 4.10.0roslyn language sever
for C# version 4.12.0ruby-lsp
Diagnostics are pulled when a document is changed for each language server with pull diagnostics feature with an async hook after a debounce period.
Diagnostics are also pulled when a document is opened, when changed to buffer and when a language server is successfully initiated. This is done without debounce.