дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
feat(languages): Jinja2 Template language for .jinja, .jinja2 and .j2 files (#6645)
.jinja, .jinja2 and .j2 files opened as Plain Text. They now open as Jinja2 templates, with the extension before them deciding the content between the tags: Jinja2 HTML (.html.j2, .html.jinja, .htm.*) gets the HTML language server, Emmet, tag closing and linked tags like Django templates; any other name (nginx.conf.j2, values.yaml.j2, base.jinja) is a Jinja2 Template over plain text without HTML tooling. Both use @codemirror/lang-jinja (now a direct dependency, the same 6.0.1 already in the lockfile): highlighting, folding and indentation of block statements, completion of tags, filters and tests, and tag matching. The file icon follows the extension before .j2, and breakpoints in a file typed as a Jinja language turn on debugpy's jinja support. Closes #6644 Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
1 джерело
5b486f1588
коміт
9ee8f67e9f
22 files changed
+288
-14
No files matched your search
@@ -179,6 +179,10 @@ With **Django Template LSP** (`djlsp`, installed from **Settings › Languages &
|
||||
|
||||
An HTML file elsewhere with Django tags shows a banner that switches it to Django Template or keeps it as HTML; either choice is the file's **Override File Type**.
|
||||
|
||||
### Jinja2 templates
|
||||
|
||||
`.jinja`, `.jinja2` and `.j2` files open as Jinja2 templates. The extension before them decides what is between the tags: `page.html.j2`, `base.html.jinja` and the other `.html.*` / `.htm.*` names are **Jinja2 HTML** files, any other name (`nginx.conf.j2`, `values.yaml.jinja2`, `base.jinja`) is a **Jinja2 Template** of plain text. Tags, expressions, filters and comments are highlighted, block statements (`{% block %}`, `{% if %}`, `{% for %}`, `{% macro %}` and the others) fold and indent their content, and Jinja's tags, filters and tests complete. Typing `%` between braces makes `{% %}`. **Comment with Line Comment** and **Comment with Block Comment** use `{# … #}`. In Jinja2 HTMLs the markup is highlighted too, tags close and rename in pairs, and the HTML language server and Emmet work between the template tags. A Python debug configuration stops at breakpoints in both. To open another file as a Jinja2 template, such as a `base.jinja` that holds HTML, use its **Override File Type**.
|
||||
|
||||
## Limitations
|
||||
|
||||
- Only one type checker runs at a time. Ruff runs only in projects with a Ruff configuration.
|
||||
|
||||
Reference in new issue
Заблокувати користувача