Skip to main content

jinja-lsp

CI Release

Language server for Jinja templates — diagnostics, navigation, completions, hover, and Jinja-aware formatting. One Rust binary, any LSP-capable editor. Static analysis only — it never imports, renders, or executes your templates or host Python.

It runs alongside your Python and HTML language servers, owning the Jinja layer end to end and staying silent everywhere else.

Features

Diagnostics 21 checks — undefined variables/filters/functions/tests, unused macros/imports, duplicate & shadowed bindings, inheritance errors, wrong call args, missing templates; inline noqa suppression
Navigation go-to-definition (macros, blocks, templates, imports), find references, document & call hierarchy
Hover built-in docs for filters/tests/functions, macro signatures, variable scope and definition site
Completions variables, attributes, filters, tests, statement keywords, template paths, imported macro names
Signature help macro and filter call signatures, with the active argument highlighted
Symbols & lenses document symbols, semantic tokens, folding, inlay hints, reference/override code lenses
Code actions quick-fixes from the diagnostic catalog, extract-to-macro, wrap-in-block/if/for, and rename
Formatting Jinja-aware formatting of the template layer — jinja-lsp format
check CLI the same diagnostics as a linter — jinja-lsp check . with rich / compact / json output

Installation

uv tool install jinja-lsp

Or with pip:

pip install jinja-lsp

Both install a self-contained Rust binary — no Rust toolchain, no Python runtime dependency. Or download a pre-built binary from the releases page.

Arch Linux (AUR) — named jinja-lsp-plus-bin, not jinja-lsp-bin, which belongs to an unrelated project:

yay -S jinja-lsp-plus-bin

Editor setup

The server is launched as a subprocess and speaks LSP over stdio (jinja-lsp lsp). There is no TCP/socket transport.

Neovim

Using nvim-lspconfig — paste this into ~/.config/nvim/init.lua:

local lspconfig = require("lspconfig")
local configs   = require("lspconfig.configs")

if not configs.jinja_lsp then
  configs.jinja_lsp = {
    default_config = {
      cmd       = { "jinja-lsp", "lsp" },
      filetypes = { "jinja", "jinja.html", "htmldjango" },
      root_dir  = lspconfig.util.root_pattern("jinja.toml", "pyproject.toml", ".git"),
      -- mirrors jinja.toml; all keys optional — overlay on top of any discovered config file
      init_options = {
        templates = { "templates", "..." },
        extras    = {},
        hints     = {},
        lint      = { select = {}, ignore = {} },
      },
    },
  }
end

lspconfig.jinja_lsp.setup({})

Neovim 0.11+: you can also use the built-in vim.lsp.config API instead:

vim.lsp.config('jinja_lsp', {
  cmd = { 'jinja-lsp', 'lsp' },
  filetypes = { 'jinja', 'jinja.html', 'htmldjango' },
  root_markers = { 'jinja.toml', 'pyproject.toml', '.git' },
})
vim.lsp.enable('jinja_lsp')

Helix

# ~/.config/helix/languages.toml
[language-server.jinja-lsp]
command = "jinja-lsp"
args = ["lsp"]

[[language]]
name = "jinja"
language-servers = ["jinja-lsp"]

[[language]]
name = "html"
language-servers = ["jinja-lsp"]

Zed

Install from the Zed extensions panel (Cmd+Shift+X) — search for Jinja Plus and click Install (extension id jinja-plusjinja-lsp was already taken on Zed's marketplace). It activates automatically for Jinja and HTML templates.

To control server order alongside other language servers or pass initialization options, add to ~/.config/zed/settings.json (the language-server id is jinja2-lsp and the language is Jinja2 (HTML)):

{
  "languages": { "Jinja2 (HTML)": { "language_servers": ["jinja2-lsp"] } },
  "lsp": { "jinja2-lsp": { "initialization_options": { "templates": ["templates"], "extras": ["starlette"] } } }
}

Configuration

Zero config for standard projects — template directories are discovered automatically (templates/, <project-name>/templates/, jinja/, j2/). A discovered config file (jinja.toml, then [tool.jinja] in pyproject.toml) — or the zero-config defaults when there's none — is the base; the editor's InitializationOptions are then overlaid on top, overriding only the keys they set while leaving the rest of the file intact.

Option Default
templates (auto-discovered) template root directories; "..." expands to the discovered set
extensions ["html", "jinja", "jinja2", "j2"] file extensions to scan
extras [] framework packs: flask, starlette, starlette-babel, starlette-flash
hints [] directories of hint files describing your project's context variables/macros
custom_builtins [] directories of built-in-format *.md docs for third-party filters/functions/tests
inline_patterns ["render_template_string"] host render-function names whose string argument is parsed as an inline template
lint.select (all) diagnostic codes/classes to enable (JINJA-E1, JINJA-W, …)
lint.ignore [] diagnostic codes/classes to suppress
# jinja.toml
templates = ["templates"]
extras = ["starlette"]

[lint]
ignore = ["JINJA-W106"]

CLI

jinja-lsp lsp                                              # run the language server over stdio
jinja-lsp check PATH [--select CODES] [--ignore CODES] [--format rich|compact|json]
jinja-lsp format PATH [--check]

check's json output matches the format the test suite asserts against, so it diffs cleanly in CI. format rewrites the Jinja layer only and is round-trip safe.

Development

cargo build
cargo nextest run
uv run --group dev pytest tests/e2e/ -v

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

jinja_lsp-0.2.0-py3-none-win_amd64.whl (3.1 MB view details)

Uploaded Python 3Windows x86-64

jinja_lsp-0.2.0-py3-none-manylinux_2_28_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

jinja_lsp-0.2.0-py3-none-manylinux_2_28_aarch64.whl (2.9 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

jinja_lsp-0.2.0-py3-none-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file jinja_lsp-0.2.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: jinja_lsp-0.2.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for jinja_lsp-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 744293d7c6b208e2a76864fa735755cee749c726da04697baf6b677017390584
MD5 a6aaf9d608a76ec341f4e234e12166b5
BLAKE2b-256 31969259d6504fdda4aef567cd8fe872c0d845904014570368cc8a4cfec9fa8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for jinja_lsp-0.2.0-py3-none-win_amd64.whl:

Publisher: release.yml on alex-oleshkevich/jinja-lsp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jinja_lsp-0.2.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for jinja_lsp-0.2.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5490dd4a0cb7403297b1467bbb4cecd4b091c5762e058434cead5b78b28b06b4
MD5 803a03edd845746a850977ae3db4ac88
BLAKE2b-256 c26fe94d8024c1b797c55915a50ed749404d49bc6d8b53803251bd2a5208ebee

See more details on using hashes here.

Provenance

The following attestation bundles were made for jinja_lsp-0.2.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release.yml on alex-oleshkevich/jinja-lsp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jinja_lsp-0.2.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for jinja_lsp-0.2.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b215425400bf7a2f3676df4da7ff8616894ed31f90e7842c2aadf7888724ad0c
MD5 b32bb036ae35115e0fca20b5f6e2d31b
BLAKE2b-256 f72beaa642e3e5c8a954c63f5a9182ba0486381853dc86ce9ca15db6315fe067

See more details on using hashes here.

Provenance

The following attestation bundles were made for jinja_lsp-0.2.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release.yml on alex-oleshkevich/jinja-lsp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jinja_lsp-0.2.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for jinja_lsp-0.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 114bc9b7060110358b5e187f9b6c0a9c54d3881acb135d17c20048787f298419
MD5 01c5f2b3501eb523acbb08b5a0fc8825
BLAKE2b-256 4e24fe03c21a6089b41c84c9a03a52c1f3443f85ff61febbcc8433d6eb42edf1

See more details on using hashes here.

Provenance

The following attestation bundles were made for jinja_lsp-0.2.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on alex-oleshkevich/jinja-lsp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.4.2

4 files

0.4.1

4 files

0.4.0

4 files

0.3.0

4 files

This release

0.2.0 This release

4 files

0.1.0

4 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page