-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
docs: how to make diagnostics work with ruby-lsp #2498
Conversation
b6bd6dc
to
3ce3d25
Compare
I think it would be better in ruby-lsp doc or somewhere then we can use that link . |
I believe the folks on However, I understand that is also important update the usage instructions present on More specifically since ruby-lsp v0.2.2 that according to Shopify/ruby-lsp#242 dropped support to textDocument/publishDiagnostics natively used by neovim, in favor of only maintain the textDocument/diagnostic from LSP v3.17 specification that requires the client to decide when to pull for diagnostics. |
I think the point is we should implement handler for |
merge this first . but please create an issue in core for create handler for |
44c9c24
to
56e41c6
Compare
However, ruby-lsp since the version `0.2.2` does not support this | ||
specification for diagnostics. | ||
Instead, it implements the `textDocument/pullDiagnostic` specification, | ||
that expects the client to send `textDocument/diagnostic` requests to the server |
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.
Instead of adding a huge amount of documentation (for one lang server....), do we need a feature request in Nvim core? Why does it only work with old versions of ruby-lsp ? Is Nvim LSP missing a standard LSP feature?
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.
Is Nvim LSP missing a standard LSP feature?
this is feature in lsp 3.17 .. as far as i know we missing some lsp feature like ontypeformat
workspace/diagnostic
workspace/diagnostic/refresh
textDocument/diagnostic
etc ..
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.
@justinmk You are right about nvim core and lspconfig missing some features from LSP, but even if the feature get requested, it will have a long roadmap to wait for until lspconfig
be able to work again as the current documentation is describing.
I forgot to make the feature request as recommended by @glepnir previously, but I think that in the meantime, we would like to complement the documentation for this lang server, just because if someone follow the instructions on it will not get lspconfig working as described.
That is because the current versions for this lang server implements only Pull Diagnostic from LSP v3.17 and dropped support to textDocument/publishDiagnostic
, which is the only currently supported by Nvim.
There are alternatives to these extensive instructions, but any alternative would have a drawback of any sort:
- Make the instructions limit to use a version of
ruby-lsp <= 0.2.1
- That is the highest version the current version of nvim/lspconfig is compatible with
- That would limit users capacity to benefit of eventual security patches and other features that nvim might be compatible already but are only present on more recent versions for
ruby-lsp
- Nvim core and lspconfig implement
textDocument/diagnostic
from Lsp v3.17- Besides it being the best scenario, some would need to wait for the roadmap for both core and lspconfig to be released to have diagnostic working again as described in the current instructions.
- This is the only lang server that I'm aware that does not support
textDocument/publishDiagnostic
anymore. I don't know if it's something that will be dropped by LSP and would increase the priority, but so far the priority might be pretty low if ever implemented.
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.
Should we rename the server to ruby_lsp
instead of ruby_ls
?
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.
Makes less sense IMO. We are using the language server for ruby, the protocol is just a boring specification.
Edit: wait a minute, the language server is called ruby-lsp
? bruh... OK, maybe this kinda makes sense then.
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.
@dundargoc yes, the name of this language server is ruby-lsp
and it's not the only language server for ruby supported by nvm-lspconfig. lspconfig also supports solargraph
, the other language server for ruby.
Hey @cefigueiredo thank you for the instructions. I created a core ticket yesterday to add the textDocument/diagnostic feature to neovim using your explanation on the issue. Let me know if you want to add anything! |
Would it be reasonable to just added the recommended workaround to I can think of a few ways to detect the older versions, but they are kinda dirty. Maybe an option to work for new vs old ruby-lsp? |
I don't believe it would be reasonable. Because it would either be too invasive for the users or just not work on most cases. This
The table provided by the user is merges onto the default settings of the lsp client, replacing the table keys that match. So, if the default settings for To make the server client default settings declare a function to be run when the client is loaded in the buffer, but not affecting the The ideal, is neovim-core support the PullDiagnostic feature from LSP specification out of the box, when that happens, the workaround would not be needed anymore. But this will take a while to enter the core roadmap. Until then, I believe that the instructions in the doc would be the more reasonable option. |
Updates the docs instructing how to make `ruby_ls` diagnostics work with recent versions of `ruby-lsp`. Co-authored-by: Sergio Marquez <marquez.sergio.d@gmail.com>
35d84d0
to
18de2cb
Compare
If there's a bug in Nvim LSP client, check Nvim 0.10 (development version) and say how to reproduce the issue. Adding tons of special-case notes and configs to nvim-lspconfig is out of scope. |
ruby-lsp >= 0.2.2
does not implementtextDocument/publishDiagnostic
specification that is supported by Neovim, implementing only thetextDocument/diagnostic
.This commit presents a workaround to make
ruby_ls
sendtextDocument/diagnostic
requests to the Server, and treat the response like it was for atextDocument/publishDiagnostic
event.