Closed Shatur closed 4 years ago
Thank you for reporting. I have the same opinion we should improve expansion handling.
The LSP spec has the CompletionItem#commitCharacters
that is the same concept.
But I'm busy now... anyway I will start considering it.
Interesting, did not know about commitCharacters
property.
Sorry, vsnip_integ can not support LSP's commit character (It would be good to support on completion-engine or LSP client).
But I implemented vsnip#skip_complete_done
API.
Could you test it?
Sorry, vsnip_integ can not support LSP's commit character (It would be good to support on completion-engine or LSP client).
Thanks for the explanation!
I tested add-manual-skip
with the following mapping from the readme:
inoremap <expr> <C-y> vsnip_integ#skip_complete_done('<C-y>')
But I have the following error on snippet expansion:
I just selected built-in function
snippet in vim-language-server
and pressed <CR>
. Also the same with <C-y>
.
Do I configured it correctly?
My tested environment are the following.
omnifunc
via <C-x><C-o>
inoremap <expr> <C-y> vsnip_integ#skip_complete_done('<C-y>')
only (Did not using <CR>
key to confirmation key)Hm... this problem seems to have a complex dependency on many of the plugins.
Probably, We should consider more better API than current one.
FYI: I think the error may be avoidable by updating nvim to the latest.
Could you tell me the your tested environment (I think you used completion-nvim + nvim built-in lsp.
My tested environment are the following.
I tested with exact the same environment! I also updated neovim to the latest commit in master.
But you are right, the problem was in my completion-nvim
and pear-tree
conflict. The following setting causes the issue:
let g:completion_confirm_key = ''
It used to make the following mapping (the problem exists even without this mapping, only settings above is enough):
imap <expr> <CR> pumvisible() ? complete_info()['selected'] != '-1' ? '<Plug>(completion_confirm_completion)' : '<C-e><CR>' : '<Plug>(PearTreeExpand)'
Can I somehow avoid this conflict? Maybe there is exists another "pairs" plugin without key mappings?
I think the problem does not occurs when if you use C-e
instead of C-y
.
I want more better solution but I don't know that for now...
I think the problem does not occurs when if you use C-e instead of C-y.
I tried with the following mapping: inoremap <expr> <C-e> vsnip_integ#skip_complete_done('<C-e>')
but it just closes completion window :(
Maybe it is possible to add a function to skip expansion manually? Say, expand completion items on <CR>
/ <C-y>
and do not expand with <A-CR>
(for example, user will can map it to any key)?..
BTW, ho do you handle it? You just do not use snippet auto expansion?
Oh, Sorry I expected to map inoremap <expr> <C-e> vsnip_integ#skip_complete_done('<C-y>')
.
I guess completion-nvim sends <C-y>
as imap instead of inoremap.
So probably we can't use properly <C-y>
and <CR>
for separate use-case.
Got it! I think that will be better to send a proposal to completion-nvim to solve this issue. Thank you for your effort!
Previously you have added auto_expand feature. I use it every day, it is very convenient. But sometimes I do not need expansion, for example:
I want to change
my_function
I can't use completion because it will be expanded automatically and I will have something like the following:So, I suggest to make this function more smart. For example, do not expand function if next symbol is not a space. This is how it works in most IDE's. Or, as alternative, the ability to complete text without expansion manually. For example, autoexpand on
<CR>
and insert without expansion with<C-y>
.