SirVer / ultisnips

UltiSnips - The ultimate snippet solution for Vim. Send pull requests to SirVer/ultisnips!
GNU General Public License v3.0
7.51k stars 690 forks source link

ultisnips help autocomplete plugin for inserting the function prototype #559

Closed 7belrhalmia closed 9 years ago

7belrhalmia commented 9 years ago

i will explain this excelent feature that has been implemented in neosnippet by shugo :

in current autocomplete plugin like neocomplete and youcomplete me they don't insert the function prototype and let you move beetwen paramettre by pressing tab . shugo has add a feature to neosnippet that when you complete a function by neocomplete , neosnippet create an auto-snippet and insert all the function prototype and let you move between paramettre by pressing tab.

this issue is discased her : https://github.com/Shougo/neocomplete.vim/issues/461

7belrhalmia commented 9 years ago

this is for me a killing feature that ultisnips must have

7belrhalmia commented 9 years ago

there is an exemple of neocomplete work with neosnippet

recorded

gifrecord_2015-08-25_230232

SirVer commented 9 years ago

Awesome explanation, now I get exactly what you want. Though I agree with @Shougo that this is not the job of the snippet plugin, but the job of the autocompleter.

UltiSnips already has all the features to support this: The autocompleter (YouCompleteMe or neocomplete or deoplete or whatever) is the one that has all the knowledge to construct a proper snippet, the snippet engine then needs to be able to expand a snippet that is not defined in a file.

For UltiSnips, that is UltiSnip#Anon.

@Shougo Could your completer optionally support UltiSnips as backends or is this prohibitive complex?

@Valloric Val, we talked about this feature in YCM over Email a while ago, you wanted to implement something different for YCM iirc, how about we revisit this?

Shougo commented 9 years ago

@SirVer Unfortunately, it is hard.

svanharmelen commented 9 years ago

Understand it's not that straight forward, but still +1

SirVer commented 9 years ago

I am not sure what to do with this issue. Semantic completion is not something a snippet plugin can provide - it can only provide the means of executing snippets dynamically. A completer plugin has to construct and launch the snippet with the semantic information only it has.

UltiSnips provides all the means necessary to launch snippets dynamically, i.e. it has all the features needed to implement this. But the integration has to be done in the completer, i.e. neo-complete, ycm or any other.

I am not quite understanding everything Shougo says in his comment, but it sounds like he has no interest to integrate UltiSnips support since it is significant effort. Also, he is probably fine with his own neo-snippets.

@svanharmelen , @7belrhalmia I think this issues is not actionable on the UltiSnips side. Do you guys agree?

svanharmelen commented 9 years ago

Yes, I fully agree... Not much (if anything) can be done in the UltiSnip code, it has to be supported in the completer code. Thx!

puremourning commented 9 years ago

just FYI - I think the main challenge is Vim. There is no way to synchronise someone selecting something from the completion menu, and using what they selected to trigger an anon. snippet. I know @Shougo implemented v:completed_item in very recent Vims, but mostly the CompleteDone event doesn't help.

Yes in ycmd we have all the necessary info to generate a snippet for a given overload and YCM can format up that snippet, but actually knowing when to apply it is pretty hard.

I'm looking at implementing a "user data" string as part of the completion structure in vim which gets passed to CompleteDone but tbh i'm not hopeful that this will fit well.

SirVer commented 9 years ago

I agree the main challenge is Vim. That is why I started https://github.com/swiboe/swiboe. http://www.sirver.net/blog/2015/08/21/design-for-the-ideal-text-editor./ :)

SirVer commented 9 years ago

Closing this as I do not know how UltiSnips can help. Let me know if that is clear to somebody.

Valloric commented 9 years ago

I just saw @SirVer's batsignal but I see @puremourning (a YCM & ycmd dev) is already here so woohoo, I can feel less bad about a 22-day delay! :)

svanharmelen commented 6 years ago

@Shougo I know it's been quite a while, but I am again looking at using deoplete together with UltiSnips and am running into this issue.

I used ncm2 a bit the last weeks, but I really like deoplete better. Yet the integration between ncm2 and UltiSnips works so good that I would just love to be able to use deoplete together with UltiSnips.

Now I noticed you saying something about neosnippet using v:completed_item, which I noticed the ncm2-ultisnips plugin used: https://github.com/ncm2/ncm2-ultisnips/blob/master/autoload/ncm2_ultisnips.vim#L31

So does could that mean that the needed info is now available and the deoplete could support this functionality as well? I'm not a star in vimscript, but looking at the code in the ncm2-ultisnips plugin makes me wonder if that could not be added to deoplete as well?

Thanks for you time!

svanharmelen commented 6 years ago

If its is still not possible and/or if you don't want to add support for it directly to deoplete, would it then be possible to create a plugin for this, just like ncm2_ultisnips?