如何在 PhpStorm 中的实时模板中使用符号 (@)?
How to use at symbol (@) inside live template in PhpStorm?
我创建了一个实时模板如下
<button type="button" @click="$click$">$label$</button>
它的快捷方式是btnbtn
当我展开模板时,它省略了整个 @click=""
部分并展开如下:
<button type="button">(cusror here)</button>
我尝试将 @ 符号转义为 \@ 然后它起作用了但是它保留了斜线?
我想我做错了什么,但不确定我做错了什么。有什么想法吗?
很可能是某种实时模板解析器限制或其他原因。
可能的解决方法是为 @
使用附加变量并为其提供默认值(因此它永远不会被触发完成):
- 将实时模板内容编辑为
<button type="button" $at$click="$click$">$label$</button>
- 单击
Edit Variables
按钮
- 对于我们的人工
at
变量——在 "Default value" 中输入 "@"
并检查 "Skip if defined" 列。
P.S. 同一个变量可以多次重复使用(如果你的代码片段中需要多个 @attribute
.
我仍然建议向 Issue Tracker -- I could not find exact match myself (lots of tickets for "live templates" to go through (1, 2)) 提交错误票...但我绝对记得看到过类似问题的票或论坛 post/question。
我创建了一个实时模板如下
<button type="button" @click="$click$">$label$</button>
它的快捷方式是btnbtn
当我展开模板时,它省略了整个 @click=""
部分并展开如下:
<button type="button">(cusror here)</button>
我尝试将 @ 符号转义为 \@ 然后它起作用了但是它保留了斜线?
我想我做错了什么,但不确定我做错了什么。有什么想法吗?
很可能是某种实时模板解析器限制或其他原因。
可能的解决方法是为 @
使用附加变量并为其提供默认值(因此它永远不会被触发完成):
- 将实时模板内容编辑为
<button type="button" $at$click="$click$">$label$</button>
- 单击
Edit Variables
按钮 - 对于我们的人工
at
变量——在 "Default value" 中输入"@"
并检查 "Skip if defined" 列。
P.S. 同一个变量可以多次重复使用(如果你的代码片段中需要多个 @attribute
.
我仍然建议向 Issue Tracker -- I could not find exact match myself (lots of tickets for "live templates" to go through (1, 2)) 提交错误票...但我绝对记得看到过类似问题的票或论坛 post/question。