-
Notifications
You must be signed in to change notification settings - Fork 656
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
LSP: completion returns snippets when client does not support them #4139
Comments
Digging a little deeper, it seems the client does not advertise for snippets, by omitting the Lines 1418 to 1430 in 422271b
|
Just calling attention to the relevant LSP messages:
The client capabilities do not mention
The above is the
It contains Ideally, for a "snippetless" client, like YCM (actually ycmd), anything from Basically, just don't do this if client doesn't support snippets. |
Mind creating a PR? You are very well-positioned to verify whether any fix is actually good |
Returning completion of kind SNIPPET is only allowed when the client has advertised support. This changes the method completion code to only return a snippet when the client supports them, and when the method has arguments. Otherwise, a plaintext completion is returned. TODO: This does not actually check the client capabilities yet, but only implements the output handling. This fixes vimeo#4139.
Returning completion of kind SNIPPET is only allowed when the client has advertised support. This changes the method completion code to only return a snippet when the client supports them, and when the method has arguments. Otherwise, a plaintext completion is returned. TODO: This does not actually check the client capabilities yet, but only implements the output handling. This fixes vimeo#4139.
I wasn't going to, but you make an excellent point, so I did anyway. I created #4144 which implements the "output side" of things and works well for my client now. It does not actually check the client capabilities yet, since it seems that the upstream protocol project does not implement this part of the client capabilities yet (I think or at least I'm not sure where to load the value from). Maybe someone else knows and can add that part? I also found some other small problems (fixed in #4143), that suddenly make Psalm LSP suddenly (seemingly) reliable in my setup, while it was rather erratic before :-) |
Returning completion of kind SNIPPET is only allowed when the client has advertised support. This changes the method completion code to only return a snippet when the client supports them, and when the method has arguments. Otherwise, a plaintext completion is returned. TODO: This does not actually check the client capabilities yet, but only implements the output handling. This fixes vimeo#4139.
Returning completion of kind SNIPPET is only allowed when the client has advertised support. This changes the method completion code to only return a snippet when the client supports them, and when the method has arguments. Otherwise, a plaintext completion is returned. When the function has no arguments, this now also returns a completion without parenthesis, for consistency with other language server implementation. TODO: This does not actually check the client capabilities yet, but only implements the output handling. This fixes vimeo#4139.
@orklah can you assign this to me. I will work on it in my work on Language Server (I've already fixed it actually) |
Done! Thanks! |
I'm using YouCompleteMe as an LSP client, and noticed an assertion error in that client. I asked they YCM developers, and they said:
I'm not familiar with the protocol, so I'm not sure what this means exactly, but I hope it is clear to you and helpful.
To reproduce it, I've used this code snippet:
Triggering a completion after the unfinished
$var->
.The YCM log, which includes all JSONRPC messages sent, is shown below. Psalm itself does not produce any output.
The text was updated successfully, but these errors were encountered: