helix icon indicating copy to clipboard operation
helix copied to clipboard

feat: Improve syntax highlighting support for template languages, such as Tera

Open nik-rev opened this issue 6 months ago • 0 comments

Template languages like Tera can be used for any language at all. They can generate JavaScript, Rust, HTML or Markdown.

That's great! But it makes syntax highlighting for these languages harder than any other. You usually have to make a dedicated grammar for each language combination, like html-tera, css-tera, js-tera etc.

With this PR, it's all in a much better position now! The language injected will be based off the file name. That is, if you have a file like index.html.tera, it will inject the html language. If you have index.css.tera, it injects css. It simply uses the 2nd extension.

What this means is that, we can basically support all template languages with any possible language that they template for.

This PR depends on this PR to tree-house

Before

image

After

image

nik-rev avatar May 17 '25 01:05 nik-rev