DEV Community

Warren Wong
Warren Wong

Posted on • Originally published at warrenwong.org on

Associate HTML as Jinja Files in VSCode

Visual Studio Code can give you syntax highlighting for your Jinja templates even though Jinja files are usually named with a *.html extension in Flask projects.

I assume you already have the Python Extension for VSCode installed.

Open your Preferences > Settings from the dropdown menu or your settings.json file inside your current project's .vscode directory and add:

{
  "files.associations": {
    "*.html": "jinja-html"
  }
}
Enter fullscreen mode Exit fullscreen mode

I wouldn't put this in the user settings.json file since that will globally associate all *.html files with jinja-html.

Discussion (1)

Collapse
edidiongesu profile image
Edidiong Esu

How do I keep both Jinja and html formatting? When I do this, I lose the html formatting.