You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not so much a bug, but a feature request for LSP. When completion is done, LSP can provide additional context about a completion item (either on selection change or completion "done") and provide things like docs or additional text edits.
Right now nothing is setup here to call completionItem/resolve in neovim itself. Other options are to have users provide their own customized callback function, which could be fine. Just wanted to raise the topic in case others were interested.
And any server that suppors it like `typescript-language-server`.
The `rust-analyzer` supports auto imports, but it does not provide them
the `additionalTextEdits` with each completion entry. They state that
that's too costly, so the LSP client should call the
`completionItem/resolve` RPC call after completion is done for the
required edits to be calculated only once[1].
I found an old GitHub issue on Neovim that hasn't been completed yet
[2], and a relevant PR has not been merged yet [3].
Then I found a Reddit thread that provided an implementation that
_almost_ worked [4]. There were two issues with the sample
implementation in Neovim 0.9.0:
1. The `result` callback argument was third, but it actually needed to be
second.
2. This version of Neovim requires a third parameter to
`vim.lsp.util.apply_text_edits` (`offset_encoding`)
For LSPs like `gopls` which don't support it yet, the quickfix dialog
can still be used (or `goimports`) , but it ends up being a two-step
operation.
[1]: https://rust-analyzer.github.io/manual.html#auto-import
[2]: neovim/neovim#13199
[3]: neovim/neovim#13414
[4]: https://www.reddit.com/r/neovim/comments/mn8ipa/lsp_add_missing_imports_on_complete_using_the/
nvim --version
: NVIM v0.5.0-787-g98024853fnvim -c ":checkhealth nvim nvim_lsp"
Not so much a bug, but a feature request for LSP. When completion is done, LSP can provide additional context about a completion item (either on selection change or completion "done") and provide things like docs or additional text edits.
Right now nothing is setup here to call
completionItem/resolve
in neovim itself. Other options are to have users provide their own customized callback function, which could be fine. Just wanted to raise the topic in case others were interested.PR in LanguageClient: autozimu/LanguageClient-neovim#1043
Implementation in vim-lsp: https://github.com/prabirshrestha/vim-lsp/blob/master/autoload/lsp/ui/vim/completion.vim#L63
Spec for completion: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
The text was updated successfully, but these errors were encountered: