Sublime Forum

Javascript syntax highlighting messed up by double curly braces (used for Smarty)

#1

Embedded in my Javascript is some Smarty templating code which, in this instance, requires double curly braces. However, this causes the rest of my JS file to be highlighted in red.

0 Likes

#2

The issue is the if in the template constructs being parsed as incomplete JavaScript conditional statement.

The builtin JavaScript syntax definition supports JavaScript. It is not made for template engines. You’d need a custom JavaScript syntax definition made for your favorite template engine.

It’s hard enough to identify all JavaScript statements and expressions. Impossible to support each of the hundreds of none-standardized 3rd-party-language extensions in one syntax definition.

0 Likes

#3

It looks like what you want is syntax highlighting for Smarty templates. There’s at least one package available, though it’s a bit on the older side.

0 Likes