Sublime Text 3:片段中引号的正则表达式替换失败

Sublime Text 3: Regular expression replacement fails on quotation marks in snippet

我编写了一个用于注释代码的自定义片段,只要有 space 后跟单引号或双引号,其中的正则表达式就会失败:

<snippet>
<content>
<![CDATA[
/*========================${0/./=/g}
  =            [=10=]            =
  ========================${0/./=/g}*/
]]>
</content>
<tabTrigger>comment-block</tabTrigger>
</snippet>

正则表达式的作用是用等号 (=) 替换输入,使其看起来像一个花哨的评论块。但是只要遇到 space 后跟任何引号,它就会停止替换文本并打断注释块。

自己尝试一下,加载代码段,输入 comment-block 并按 Tab,然后输入 "This is a ' comment block"。遇到单引号会断

我怎样才能正确转义 '" 来完成这项工作?在 . 之前添加反斜杠没有任何作用。

不幸的是,我没有解决方案,但这只是最近作为已知 issue, so it's not just you. It seems that if any snippet (including auto-matching) is triggered within the substitution regex, the regex just quits. I confirmed the issue on both OS X 10.10 and Ubuntu 15.10, using the latest development build 的 Sublime 提交的,所以自从最近的 public 测试版发布以来,它一直没有得到修复.

我会继续尝试,看看我是否能想出一个解决方法,但现在我想我们只能忍受它。