helix icon indicating copy to clipboard operation
helix copied to clipboard

Add language: jinja2

Open AceofSpades5757 opened this issue 3 years ago • 2 comments

Not sure how this would work as it can be embedded in any language, or text file.

  • [ ] Set precise settings (e.g. there probably shouldn't be a file type since it should just be a text file, html file, etc.)
  • [ ] highlights.scm
  • [ ] indents.scm
  • [ ] Other scm

AceofSpades5757 avatar Aug 04 '22 07:08 AceofSpades5757

Not sure how this would work as it can be embedded in any language

Tree-sitter doesn't have a built-in way to make the injection language configurable like a templating language would need. This could be handled in a follow-up PR and would benefit other templating languages like EEx. It needs some design but we could have some sort of variable in the injections.scm queries that is derived from the file-type, like .html.j2 files would have the variable set to html.

((some_node) @injection.content
 (#set! injection.combined)
 (#set! injection.language $some_magic_language_variable))

the-mikedavis avatar Aug 04 '22 11:08 the-mikedavis

This should also apply to other template languages with equivalent syntax such as nunjucks (.njk) and twig (no official extension but some editors recognize .twig)

valpackett avatar Oct 13 '22 20:10 valpackett

clsoing this one as stale. Thank you for contributing!

pascalkuthe avatar Apr 13 '24 23:04 pascalkuthe

This cannot actually go "stale", these template languages aren't just going away.

valpackett avatar Apr 13 '24 23:04 valpackett

this PR was a draft for nearly two years. It wasn't finished, had conflicts and wasn't going to be merged in this form. This is not an issue but a PR after all. If somebody wants to see jinja2 support they should make a new PR.

pascalkuthe avatar Apr 13 '24 23:04 pascalkuthe