Sublime Forum

Javascript ES6 template literals syntax for HTML for ST4

#1

Hi,

What is the solution for html syntax in template literals with Sublime Text 4 ?

Thanks.

0 Likes

#2

Ignore my answer and use the one below.

this is the settings I used to get it to work

    "configurations": {
        "HTML Recipe": {
            "typescript":true,
            "custom_templates": {
                // To highlight any untagged template as HTML
                "default": "scope:text.html.basic",
                "lookaheads": {
                    // To highlight `<div>Hello, World!</div>`
                    "<": "scope:text.html.basic",
                },
                "comments": {
                    // To highlight /*html*/`<div>Hello, World!</div>`
                    "html": "scope:text.html.basic",
                },
                "tags": {
                    // To highlight html`<div>Hello, World!</div>`
                    "html": "scope:text.html.basic",
                }
            }
        }
    }
}

well that failed and got a recursion limit on big files this package seems to work though
https://packagecontrol.io/packages/LitElement%20Syntax%20Highlighting

0 Likes

#3

I wouldn’t recommend those solutions anymore as with_prototype is well known to cause syntaxes to hit 25k contexts sanity limit.

JSCustom supports various ways to add such extensions to JS/TS in more elegant ways. AFAIK it also supports template literals.

0 Likes

#6

Thanks for the replies.

JSCustom is not working for me. But the Lit Element is working well.

Thanks.

0 Likes