Vscode escaping a slash before using a variable

半腔热情 提交于 2019-12-11 19:15:07

问题


I was checking out the VS Code snippets the other day, and upon wanting to create a certain snippet I stumbled upon this problem:

"body": [
            "test=\"some\\path\\$1\""
        ]

I want to escape the slash after 'path' but I dont want to escape the variable, which does now happen since it's the same notation as \$. But I want to escape the slash and just let my $1 be.

Any ideas on how to "unescape" this? I tried doing the string separately, but I couldnt find a way to concatenate strings either!

Help would be appreciated :)


回答1:


I think you want:

"test=\"some\\path\\\\$1\""

this gives:

test="some\path\[cursor here]"


来源:https://stackoverflow.com/questions/52302768/vscode-escaping-a-slash-before-using-a-variable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!