Autocompletion cuts off last character for parameter replacement.
Here's a screencast of what is happening, as it's a little hard to describe:
https://streamable.com/s/jdt9u/llbvcw.gif
I'm using the default omnisharp server, omnisharp-vim, Supertab, and ultisnips.
Basically, when I do parameter completion, it cuts the last character off the parameter and I have to manually delete it every time.
Did you find a solution?
Did you try to select a suggestion and pressing escape instead of pressing tab or enter or any other key?
I'm impressed someone followed up -This was a long time ago - but no, I didn't find a solution, I ended up giving up on that feature.
I actually moved to VSCode because using C# with Vim was hard to get to work right. I'd love to be able to go back, the VSCode vim bindings aren't that great.
On Thu, Dec 5, 2019 at 4:10 AM DasOhmoff [email protected] wrote:
Did you try to select a suggestion and pressing escape instead of pressing tab or enter or any other key?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OmniSharp/omnisharp-vim/issues/336?email_source=notifications&email_token=AACBR6HCT7S2TWY5WNVGDZDQXDASFA5CNFSM4ET36IH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGAAQVY#issuecomment-562038871, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACBR6FEGFKUJYSEAO2KT4TQXDASFANCNFSM4ET36IHQ .
Ah, I see.
Hey guys, I did manage to recreate this once, but never found the error (I don't usually use snippets myself). I can try to give it another look - I've always meant to dig into it but never found the time, sorry.
Well, I'm really stuck on this. I'm inclined to think it might be a bug in the Vim python package? For some reason that I just can't work out, it is UltiSnips/vim_helper.py#L184 that causes an extra space (or spaces) to be inserted at the start of the argument list:
buf.cursor = start
That cursor setter contains the real culprit:
vim.current.window.cursor = pos.line + 1, nbyte
This is the line that is inserting a space, but why? Commenting out line 184 results in correct snippet insertion - but the semi-colon at the end now has whitespace in front it it (possibly from other calls to vim.current.window.cursor?).
The other thing is that all of this only appears to occur when using the UltiSnips trigger, g:UltiSnipsExpandTrigger. Selecting a completion using Vim's native <C-y> seems to work perfectly well - the snippets are inserted as expected.
However attempting to map something else to <C-y> results in the same issue:
inoremap <Tab> <C-y>
This is what makes me think this is a Vim bug - <C-y> works as expected, but spaces are inserted when using it from a mapping.
I'll try to put together a minimal example and raise it as a Vim issue. In the meantime, I recommend using <C-y> as a workaround.
Pretty sure this feature only worked for a small amount of time and was hardly tested.
I somehow managed to talk @markwoodhall into implementing it after I'd already defected to Emacs. He shortly defected to Clojure I believe, leaving nobody actually using this feature :)
@nosami it's actually a great feature and for the most part works really well (except for this annoying issue). I did use it for a while.
The reason I stopped using it was the same reason I always stop using things like autopairs or delimitmate - I find automatically inserted code gets in my way more than it helps. But that's a personal style preference and not a reflection on the feature.