2

I try to create multilines snippet like so:

"mySnippet": {
        "prefix": "test",
        "body": [
            "<div>",
                "<p></p>",
            "</div>"
        ]
    }

But it's not indented...

Reading the doc doesnt' help

2 Answers 2

3

You need to add the indentation inside the second string element of the body array:

"mySnippet": {
        "prefix": "test",
        "body": [
            "<div>",
            "  <p></p>",
            "</div>"
        ]
    }
Sign up to request clarification or add additional context in comments.

1 Comment

is there another way of doing it with CDATA?
1

You can use the \tfor TAB on each line:

"table": {
    "prefix": "table",
    "body": [
        "<table cellspacing=\"0\" cellpadding=\"0\">",
            "\t<tr>",
                "\t\t<td>",
                    "\t\t\t<i class=\"fas fa-bullhorn\"></i>",
                "\t\t</td>",
                "\t\t<td>",
                    "\t\t\t${1:element}",
                "\t\t</td>",
            "\t</tr>",
        "</table>"
    ],
    "description": "Text with a bullhorn icon on the left"
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.