【问题标题】:How do I insert tabulation inside VS Code snippet?如何在 VS 代码片段中插入表格?
【发布时间】:2021-04-28 11:25:19
【问题描述】:

我在 VS Code 中有一个代码 sn-p,看起来像这样

"JS arrow function": {
    "scope": "javascript, typescript",
    "prefix": "af",
    "body": [
        "const ${1:name} = (${2:props}) => {",
        "   $3",
        "}"
    ],
    "description": "Create arrow function"
}

我想在$3 制表位之前有tabulation,但VS Code 显示错误:

字符串中的字符无效。控制字符必须转义。

同时将4 spaces 放在$3 之前可以正常工作,但我需要tabulation 完全用于我的eslint 配置。

有没有办法把tabulation放在那里?

【问题讨论】:

    标签: javascript visual-studio-code eslint code-snippets vscode-snippets


    【解决方案1】:

    \t

    这是转义的制表符。

    "JS arrow function": {
        "scope": "javascript, typescript",
        "prefix": "af",
        "body": [
            "const ${1:name} = (${2:props}) => {",
            "\t$3",
            "}"
        ],
        "description": "Create arrow function"
    }
    

    【讨论】:

      猜你喜欢
      • 2021-09-10
      • 1970-01-01
      • 2017-03-16
      • 2011-11-21
      • 1970-01-01
      • 1970-01-01
      • 2021-03-25
      • 2021-07-12
      • 1970-01-01
      相关资源
      最近更新 更多