Open skewballfox opened 4 years ago
I think this makes sense. We could solve this by making it so that only the first capture group of a trigger gets removed during expansion. This way your example could be done with the trigger \s*(do)
. As a downside, it would require all current 'plain' snippets to be wrapped in parentheses, but that's not such a big deal.
I think this should go in
snippets-expand-trigger
but I'm not exactly sure as I'm still trying to make sense of the code.I set a few of my snippets to trigger at the start of a line with respect to indentation by adding
^(\s*)
to the start of the trigger. for example(\s*)do
triggers:and
but not
or
that way the snippet would work so long as the trigger is the first thing on the line, other than white space.
currently the function inserts the triggered snippet starting at the line (which makes sense because technically the whitespace was part of the trigger). it would make sense though to change this so that snippets could work with indentation.