nvim-completion-manager icon indicating copy to clipboard operation
nvim-completion-manager copied to clipboard

TODO: translate lsp snippet into local snippet format, and support completion textedit

Open roxma opened this issue 6 years ago • 3 comments

As per https://github.com/autozimu/LanguageClient-neovim/pull/121

Current vim snippet plugin's snippet syntax is different from lsp snippet.

NCM will use the well-defined lsp snippet syntax as the standard, and transform it into local snippet format.

The completion textedit should be useful for completion with auto importing, I guess. Yet I haven't seen a language server with this capability.

roxma avatar Sep 03 '17 02:09 roxma

FWIW, the Java language server (https://github.com/eclipse/eclipse.jdt.ls) utilizes the completion textedit feature.

euclio avatar Oct 04 '17 14:10 euclio

Regarding the additionalTextEdits, I have since exposed another function LanguageClient_workspace_applyEdit() https://github.com/autozimu/LanguageClient-neovim/commit/e5f91c7d9afbc976208d0bbeb2c4f8218052e995

After completion is done, following pseudo code should do the work

# assume the completed item is comp_item
if comp_item.get('additionalTextEdits') and self.nvim.funcs.exists('*LanguageClient_workspace_applyEdit'):
    bufname = self.nvim.current.buffer.name
    self.nvim.funcs.LanguageClient_workspace_applyEdit({bufname: comp_item.additionalTextEdits})

The only issue for me is that I'm not sure where should I put this action to.

autozimu avatar Jan 04 '18 03:01 autozimu

@roxma Is anything blocking this issue? Does @autozimu's code work?

euclio avatar Feb 21 '18 17:02 euclio