Open pianocomposer321 opened 1 month ago
Hi :)
you can manually adjust the priority of a snipmate-snippet by providing the priority
-keyword on the line above the definition, so
priority 1000
snippet %
{% ${1} %}
priority 1001
snippet %%
{% ${1:tag_name} %}
${0}
{% end$1 %}
where 1000 is the default, and 1001 should (IIRC) cause %% to be checked first
Interesting, I'll try this out when I can, thanks!
If it works this should be good as a workaround, but I would expect that the snippets file from vim-snippets would work as expected without needed modification. I guess it's possible that it's an issue with the snippets file itself? Is the behavior what you would expect given the snippets file? If so I could file an issue with vim-snippets.
Mhmmm, I'd have interpreted this as a clear ambiguity, so expanding either of these is equally correct.. Which snippet-engine were you using before that had your expected behaviour? Is there some spec on how these cases are to be handled? I'd be open to doing some small modifications, like checking triggers that are longer first for snipmate-sources if it gives us better compatibility, but in general I think it'd be better for the snippet-source to not have such ambiguities.
Hey so sorry I didn't see this until now. I hadn't actually tested this with any other engine, but I assumed that the behavior I get from LuaSnips was not correct since my snippets file was from the vim-snippets plugin, which is mentioned in the README. It does make sense to me for % and %% to be treated as separate snippets by the engine, either by checking length as you suggested or by taking into account the order in the snippets file. I would be willing to check how other engines deal with this case and maybe open an issue with vim-snippets if appropriate, but I'm not sure when I'll have time since school is starting for me shortly.
The jinja snippets file from vim-snippets has the following two snippets:
At least with my configuration, typing
%%
and then theexpand_or_jump
trigger expands the first snippet and leaves the first percent, when I would expect it to expand the second snippet instead. I did try changing the order of the snippet definitions, no change.