0

Bug in snippets with conditional insert with numbers

Roman Komarov 12 aastat tagasi 0

If you have a conditional insert in a mirrored field in a snippet and it's value is starting with a number, it's not inserted. Here is an example:

view.run_command("insert_snippet", {"contents" : "snippet: ${1:}${1/(.+)?/(?1:123)/}"})

I found a workaround to fix it: just adding parens — “()” — before the number fixes it (however, I'm not sure that plain braces shouldn't be inserted, so I'd recommend using the empty conditional insert there)