Aptana Ruby代码段上的转义斜杠
我试图在Aptana上创建一个新的代码段,如下所示:Aptana Ruby代码段上的转义斜杠,ruby,aptana,code-snippets,Ruby,Aptana,Code Snippets,我试图在Aptana上创建一个新的代码段,如下所示: snippet "dump em arquivo" do |s| s.trigger = "debug" s.scope = 'source.php' s.expansion = "//debug file_put_contents('${2:/var/d_tmp/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});" end //debug file_put_co
snippet "dump em arquivo" do |s|
s.trigger = "debug"
s.scope = 'source.php'
s.expansion = "//debug
file_put_contents('${2:/var/d_tmp/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});"
end
//debug
file_put_contents('/var/d_tmp/debug.log', print_r(, true) . "\n", LOCK_EX);
但是在变量${2:/var/d\u tmp/debug.log}
上,/(斜杠)
用作选项列表,反斜杠也不起作用(${2:\/var\/d\u tmp\/debug.log}
)
那么,我怎样才能避开斜杠,使代码段实际工作,输出整个字符串呢。
所需的输出应如下所示:
snippet "dump em arquivo" do |s|
s.trigger = "debug"
s.scope = 'source.php'
s.expansion = "//debug
file_put_contents('${2:/var/d_tmp/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});"
end
//debug
file_put_contents('/var/d_tmp/debug.log', print_r(, true) . "\n", LOCK_EX);
找到了答案
例如,转义是用两个反斜杠来完成的
snippet "dump em arquivo" do |s|
s.trigger = "debug"
s.scope = 'source.php'
s.expansion = "//debug
file_put_contents('${2:\\/var\\/d_tmp\\/debug.log}', print_r(${1}, true) . \"\\n\", ${3:LOCK_EX});"
end