SirVer / ultisnips

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

[FeatureRequest] Add function to provide snip content #1413

Closed hiberabyss closed 2 years ago

hiberabyss commented 2 years ago

Is it possible to have function return snip content for auto-completion description?

hl037 commented 2 years ago

What do you mean by "snip content" ? (the snippet source ?, to what it would expand without input ?)

If you want to retrieve the source code, from python you can retrieve it with _value attribute of SnippetDefinition instances. Check out this class, you can actually retrieve anything from a snippet with it

...Don't bother about the undescore, though it's undocumented api, Since this part of the code seems quite stable to me, I don't think it will change soon...

For more details, you'll have to tell more about what you want to achieve, and the context (python, vimL ? how did you get the snippet list ? etc.)

I hope I kind of provided an answer...

smjonas commented 2 years ago

As @hl037 said, if you want to access additional info than what UltiSnips provides you will need to write some Python code. If you're interested in an example, click here to see how we did it at cmp-nvim-ultisnips (that code should work for both Vim and Neovim).

SirVer commented 2 years ago

Thanks to everybody providing feedback. OP did not get back, so I assume their interest has vaned or their problem is solved. Closing.