VS Code snippet - escape ${file}

无人久伴 提交于 2019-12-22 03:43:20

问题


I'd like to create a snippet in VS Code, which includes exact string ${code}. However, when I enter it in this form, VS Code tries to interpret it as snippet parameter. How should I escape it properly?


回答1:


"}" AND "$" can be escaped with "\\". Some cases "$" can be escaped with "$$" but not in your case.

Your snippet should look like this.

"Return Code With Squirly And Dollar": {
    "prefix": "code_snippet",
    "body" : [
        "\\${code\\}"
    ],
    "description": "Code Snippet"
}

This should help you



来源:https://stackoverflow.com/questions/42669459/vs-code-snippet-escape-file

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