79131325

Date: 2024-10-27 19:31:12
Score: 0.5
Natty:
Report link

Currently, I have found that the best formatter to use for Tera templates is Twig Language 2.

Set it up as follows:

  1. Install the Twig Language 2 extension
    https://marketplace.visualstudio.com/items?itemName=mblode.twig-language-2

  2. Bind HTML to the twig language.
    Add the following settings inside your project at .vscode/settings.json

{
    "files.associations": {
        "*.html": "twig"
    },
    "emmet.includeLanguages": {
        "twig": "html"
    },
    "[twig]": {
        "editor.defaultFormatter": "mblode.twig-language-2"
    }
}
  1. After that, HTML files should automatically be detected as HTML(Twig).

    HTML(Twig)

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: jim60105