- Rust 84.8%
- Tree-sitter Query 15.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| languages/jinja2 | ||
| src | ||
| .gitignore | ||
| AGENTS.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| extension.toml | ||
| LICENSE | ||
| README.md | ||
BlueJinja
Warning
This project is heavily AI assisted. I do not recommend using it in production. Reports of issues that are reproducible are welcome, and the project will be maintained for the forseeable future.
A Zed extension that adds support for Jinja2 templates with syntax highlighting, embedded HTML language server, and jinja-lsp.
Features
- Syntax highlighting for Jinja2 tags, expressions, and inline HTML content
- Code outline (blocks, macros, extends, includes, imports)
- Bracket matching, auto-indentation, and comment toggling
- HTML language server — completions, hover, formatting for HTML content
- jinja-lsp — autocomplete, goto-definition, diagnostics, hover for Jinja
- Per-project configuration via
.jinja-lsp.json - Custom binary path overrides for both language servers
Installation
Install from the Zed Extensions marketplace, or manually as a dev extension:
- Clone this repository
- In Zed: Extensions → Install Dev Extension → select the repository folder
File Associations
BlueJinja associates with the following file suffixes by default:
| Suffix | Typical use |
|---|---|
.jinja |
Generic Jinja templates |
.jinja2 |
Jinja2 templates |
.j2 |
Short suffix |
.html.j2 |
HTML-then-Jinja order |
To use Jinja2 highlighting for plain .html files as well, add this to your Zed settings.json:
{
"file_types": {
"Jinja2": ["*.html", "*.htm"]
}
}
Note: This overrides the built-in HTML language for
.htmlfiles. The built-in HTML extension must remain installed — BlueJinja injects HTML via tree-sitter, which requires the HTML grammar to be available.
Configuration
Project-level config (.jinja-lsp.json)
Place a .jinja-lsp.json file at your project root. The extension reads it automatically and forwards the contents as initialization options to jinja-lsp:
{
"templates": "./templates",
"backend": ["./src"],
"lang": "rust",
"template_extensions": ["j2", "tex"],
"filters": ["./custom-filters"]
}
All fields are optional. See the jinja-lsp README for all available options.
Global/project settings (settings.json)
Use Zed's LSP settings to pass initialization options directly. These take priority over .jinja-lsp.json:
{
"lsp": {
"jinja-lsp": {
"initialization_options": {
"templates": "./templates",
"backend": ["./src"],
"lang": "rust"
}
}
}
}
Custom binary paths
Override the language server binary locations and control download behavior:
{
"lsp": {
"jinja-lsp": {
"settings": {
"ext": {
"html_server": {
"path": "/usr/local/bin/custom-html-server"
},
"jinja_lsp": {
"path": "/usr/local/bin/custom-jinja-lsp",
"ignore_system_version": false
}
}
}
}
}
}
| Field | Type | Description |
|---|---|---|
html_server.path |
string or null | Absolute path to the HTML language server binary. |
jinja_lsp.path |
string or null | Absolute path to the jinja-lsp binary. |
jinja_lsp.ignore_system_version |
boolean | If true, skip the PATH lookup and always download from GitHub. |
Language Servers
| Server | Provides | Source |
|---|---|---|
| vscode-html-language-server | HTML completions, hover, diagnostics, formatting | Auto-installed via npm |
| jinja-lsp | Jinja autocomplete, goto-definition, hover, diagnostics, code actions | PATH lookup or GitHub release download |
Both servers start automatically when you open a Jinja2 file.
Requirements
- Node.js — required for the HTML language server (install it separately)
- jinja-lsp — optional; if not found on
$PATH, the extension downloads a prebuilt binary from GitHub releases, or using cargocargo install jinja-lsp.
Building
BlueJinja includes Rust code for language server orchestration. Zed compiles extension Rust code to WebAssembly — this is required by Zed's extension architecture (docs).
# Install the WASM target
rustup target add wasm32-wasip1
# Build
cargo build --release --target wasm32-wasip1
Then install as a dev extension in Zed.
License
MIT