Skip to content
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

completionItem/resolve result may not be null #504

Closed
bstaletic opened this issue Dec 4, 2021 · 5 comments · Fixed by #505
Closed

completionItem/resolve result may not be null #504

bstaletic opened this issue Dec 4, 2021 · 5 comments · Fixed by #505

Comments

@bstaletic
Copy link

Hello. I'm a maintainer of a LSP client and a user yesterday asked about R support. When tried this server I encountered this:

2021-12-04 09:49:32,608 - DEBUG - TX: Sending message: b'Content-Length: 189\r\n\r\n{"id":2,"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":18,"line":83},"textDocument":{"uri":"file:///home/bstaletic/work/test/rtest/R/capabilities.R"}}}'
2021-12-04 09:49:32,675 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":2,"result":{"isIncomplete":false,"items":[{"label":"server_capabilities","kind":5,"sortText":"1-server_capabilities","detail":"[scope]","data":{"type":"nonfunction","uri":"file:///home/bstaletic/work/test/rtest/R/capabilities.R","line":79}},{"label":"update_server_capabilities","kind":3,"detail":"[workspace]","sortText":"2-update_server_capabilities","data":{"type":"function","package":"_workspace_"}}]}}'
2021-12-04 09:49:32,676 - DEBUG - TX: Sending message: b'Content-Length: 266\r\n\r\n{"id":3,"jsonrpc":"2.0","method":"completionItem/resolve","params":{"data":{"line":79,"type":"nonfunction","uri":"file:///home/bstaletic/work/test/rtest/R/capabilities.R"},"detail":"[scope]","kind":5,"label":"server_capabilities","sortText":"1-server_capabilities"}}'
2021-12-04 09:49:32,790 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":3,"result":null}'

According to the specification, the response to completionItem/resolve must be a completionItem:

https://microsoft.github.io/language-server-protocol/specification#completionItem_resolve

If the server can't return completionItem, then an error response should be sent.
This is the only thing that stops my client working with R language server.

@renkun-ken
Copy link
Member

Please checkout #505 and see if it works for you.

@bstaletic
Copy link
Author

Thanks for the quick response. I have checked out the pull request, but I am not sure how to compile or make R look for languageserver::run() in a custom directory. I did try running the tests on the PR's branch.

@renkun-ken
Copy link
Member

renkun-ken commented Dec 4, 2021

You just need to install the latest development version of languageserver via

Rscript -e "remotes::install_github('REditorSupport/languageserver')"

@randy3k
Copy link
Member

randy3k commented Dec 4, 2021

In case you haven't installed remotes.

Rscript -e "install.packages('remotes')"
Rscript -e "remotes::install_github('REditorSupport/languageserver')"

@bstaletic
Copy link
Author

Great. Confirming that it works now. Thanks for the quick patch.

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 a pull request may close this issue.

3 participants