You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to create a snippet to make a choice from a list of options. As UltiSnips supports
choices via the ${1|<choice-1>,...,<choice-n>|} syntax I was wondering if there is any way to use shell code interpolation to generate the choice syntax.
This can be done through the expansion of an anonymous snippet:
global!pdeffont_names_choicer(snip, filename):file=open(filename, "r") font_names =file.readlines() snip.expand_anon('${1|'+','.join(font_names) +'|}')endglobalpost_jump"font_names_choicer(snip, '/tmp/fontnames.txt')"snippetfontnames_snippet"Snippet for fontnames"endsnippet
In the above, '${1|' + ','.join(font_names) + '|}' results in something of the form ${1|Adobe Courier Bold,...,STIXMathJax_Variants-Regular|}, which then gets expanded through expand_anon().
I would like to create a snippet to make a choice from a list of options. As UltiSnips supports
choices via the
${1|<choice-1>,...,<choice-n>|}
syntax I was wondering if there is any way to use shell code interpolation to generate the choice syntax.When I use the following snippet
UltiSnips expands to the following:
where I would actually like to expand this again to get the desired menu of choices.
Is there a way to achieve this with UltiSnips?
The text was updated successfully, but these errors were encountered: