Slava.In
Slava.In

Reputation: 1059

How do I insert tabulation inside VS Code snippet?

I have a code snippet in VS Code, looks like this

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

I want to have tabulation before the $3 tab stop, but VS Code shows an error :

Invalid characters in string. Control characters must be escaped.

At the same time putting 4 spaces before $3 works just fine, but I need tabulation exactly for my eslint config.

Is there a way to put tabulation there?

Upvotes: 5

Views: 4697

Answers (1)

Timothy Alexis Vass
Timothy Alexis Vass

Reputation: 2705

\t

That is the tab character escaped.

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

Upvotes: 16

Related Questions