Closed kwon-young closed 5 years ago
Cannot reproduce:
Oh, I noticed that in your first example, clangd pops up with label " bar". Note that there's a space before "bar". After you expand the snippet, you get "bar" instead of " bar". It is the right behavior for ncm2.
You could get the full contents of the completed item by :echo v:completed_item
after the completion.
{'word': ' bar', 'menu': '[+] [LC] int', 'user_data': '{"snippet_word": " bar", "source": "LanguageClient_cpp", "ncm2": 1, "match_key": "abbr", "match_highlight": [[1, 3]], "snippet": "bar",
"ultisnips_snippet": "bar", "ncm2_lspitem": {"sortText": "3f2cccccbar", "insertTextFormat": 2, "detail": "int", "filterText": "bar", "kind": 5, "insertText": "bar", "label": " bar"}, "is_sn
ippet": 1}', 'info': '', 'kind': 'Field', 'abbr': ' bar'}
I think this is a clangd quirk:
"insertTextFormat": 2
defines the completion to be a snippet.Thanks a lot, it now works like a charm!
you should start clangd with -header-insertion-decorators=false
, which disables the prepended spaces
Hello, ncm2-ultisnips doesn't work well with the clangd language server for c and cpp.
First of all, all completion item will be prepend by one space. But using enter to trigger a snippet will remove the space, although the completion item is not a snippet.
When trying to use a snippet suggestion from clangd, the snippet will not expand after hitting \<CR> and the prepended space will not be removed.
Here is a minimal reproducible vimrc:
Using:
I also checked that ncm2-snippet is working well with the rust language server rls