Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim 8, UltiSnips and coc-ultisnips: `${VISUAL}` does nothing

Using vim 8, Ultisnips, and coc-ultisnips.

Consider this snippet:

snippet cdeg "Add console.debug({})"
console.debug(${0:${VISUAL:value}})
endsnippet

I would expect it to expand cdeg to console.debug(value).

The problem is if I have that buffer:

hello

Then visual select hello, press C to replace it with cdeg and then expand. I would expect the buffer to look like that:

console.debug(hello)

But instead, I get

console.debug(value)

So it would seem ${VISUAL} has no effect with coc-ultisnips. Any idea what is going on, and how to have coc-ultisnips behave like UltiSnips regarding ${VISUAL}?

like image 504
Pierre Avatar asked Oct 27 '22 22:10

Pierre


1 Answers

It could be that I was using it wrong. In UltiSnips, you have to visual select, then press , then your snippet, then again. Only then do you get your visual selection inserted.

I don't know if this works with coc-ultisnips, because I have switched back to YouCompleteMe + UltiSnips and Supertab: YCM provides better completion results for TypeScript and works fine with UltiSnips.

This is the ticket to using Tab for YCM and UltiSnips together: https://stackoverflow.com/a/22253548/10421344

like image 152
Pierre Avatar answered Nov 26 '22 21:11

Pierre