Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Salt & Jinja Syntax HighlightingNew to Visual Studio Code? Get it now.
Salt & Jinja Syntax Highlighting

Salt & Jinja Syntax Highlighting

Mycroft Mind

|
3 installs
| (0) | Free
Correct syntax highlighting for Salt .sls state/pillar files and Jinja templates (.j2/.jinja). Reuses the built-in YAML grammar and injects Jinja on top, including whitespace-control forms ({%- ... -%}).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Salt & Jinja Syntax Highlighting

Syntax highlighting for Salt state/pillar files (.sls) and Jinja templates (.j2, .jinja) in Visual Studio Code.

Features

File pattern Language Highlighting
*.sls Salt SLS YAML + Jinja
*.j2, *.jinja (conf, env, systemd units, …) Jinja Jinja highlighted, body plain text
  • Whitespace-control delimiters ({%- ... -%}) are colored evenly on both ends.
  • Jinja is highlighted at every YAML nesting level.
  • Plain .yml / .yaml files are unaffected.

Highlighting *.yaml.j2 as Salt SLS

If you keep templated YAML in *.yaml.j2 files, map them to the sls language in your project's .vscode/settings.json:

{
  "files.associations": {
    "*.yaml.j2": "sls"
  }
}

Install

From the Marketplace: search for "Salt & Jinja Syntax Highlighting" in the Extensions view (Ctrl+Shift+X), or install from the command line:

code --install-extension MycroftMind.salt-syntax

Then fully quit and reopen VS Code.

Known limitations

  • Jinja nested deeply inside YAML block scalars gets best-effort scoping.
  • {% raw %} ... {% endraw %} content is not treated as fully literal.
  • For non-YAML templates (.conf.j2, env.j2, service.j2), only the Jinja is highlighted; the underlying body (INI/env/systemd) stays plain text.

Building from source

The extension is pure JSON grammars — there's no compile step, only packaging with vsce:

# Requires Node.js 18+
npx --yes @vscode/vsce package   # produces salt-syntax-<version>.vsix
code --install-extension salt-syntax-<version>.vsix

License

MIT © Mycroft Mind, a.s.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft