Reputation: 5262
Given the following test.sublime-snippet
<snippet>
<content><![CDATA[//test replacement
//${1}
//${1/(.*)/<$1>/g}
]]></content>
<tabTrigger>test</tabTrigger>
</snippet>
Install it. Trigger it with test
Tab. Enter some text and you'll see replacement stops when you enter the left square bracket [ key. Sublime correctly auto-places the other bracket ] though it should continue to match.
Is this a bug or am I missing a special escape character?
Here is the buggy snippet I'm trying to fix: Go Class snippet
Upvotes: 2
Views: 223
Reputation: 16055
This is a bug in Sublime Text, whereby, when the insert_snippet
command is executed when typing [ for example, when auto_match_enabled
is set to true, it causes ST to lose the information about the regex substitution for the snippet you were originally typing in.
It has been logged as an issue here: https://github.com/SublimeTextIssues/Core/issues/1017
the only workaround at the moment would be to implement the same auto_match_enabled
functionality without using the insert_snippet
command.
Upvotes: 1