Файли
openidea/languages/jinja-html.toml
T
LU XIANGRUIтаwildcatDownstairs 5338a34008 feat(languages): Jinja2 templates in Flask projects, with template name completion and navigation (#7657)
.html files under a templates folder open as Jinja2 HTML when the nearest folder above that declares anything declares flask, quart, fastapi, starlette or jinja2 (pyproject.toml, requirements*.txt, Pipfile, setup.cfg, setup.py). A Django project (django declared or manage.py), package.json, angular.json, .git and the home folder end the search; File Types associations and Override File Type win; .htm is untouched; dependency files edited in place are detected again. Template names complete and navigate in extends / include / import / from and in render_template, stream_template, get_template, select_template and TemplateResponse.

Closes #7656

Co-authored-by: wildcatDownstairs <[email protected]>
2026-12-03 17:15:32 +08:00

56 рядки
2.0 KiB
TOML
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
id = "jinja-html"
name = "Jinja2 HTML"
extensions = ["html.jinja", "htm.jinja", "html.jinja2", "htm.jinja2", "html.j2", "htm.j2"]
block-comment = ["{#", "#}"]
indent = { tab-size = 2, insert-spaces = true }
ui-mode = "Jinja HTML"
tree-sitter = "html"
# Flask and other projects that render with Jinja2: the HTML files in a
# `templates` folder. A Django project's stay Django templates.
[[framework-files]]
folder = "templates"
extensions = ["html"]
root-markers = [
"pyproject.toml::flask,quart,fastapi,starlette,jinja2",
"requirements*.txt::flask,quart,fastapi,starlette,jinja2",
"Pipfile::flask,quart,fastapi,starlette,jinja2",
"setup.cfg::flask,quart,fastapi,starlette,jinja2",
"setup.py::flask,quart,fastapi,starlette,jinja2",
]
exclude-markers = [
"manage.py",
"pyproject.toml::django",
"requirements*.txt::django",
"Pipfile::django",
"setup.cfg::django",
"setup.py::django",
]
stop-markers = [".git", "package.json", "angular.json"]
# The markup between the template tags: completion and hover of tags and
# attributes. No formatter: HTML formatters reflow template tags.
[[language-servers]]
name = "vscode-html-language-server"
command = "vscode-html-language-server"
args = ["--stdio"]
initialization-options = { embeddedLanguages = { css = true, javascript = true } }
install-hint = "npm i -g vscode-langservers-extracted"
# Tailwind CSS: class completion, hover and diagnostics, only in a project that uses Tailwind
# (`tailwind.config.*` or `tailwindcss` in package.json). After the language's own servers,
# which answer hover first.
[[language-servers]]
name = "tailwindcss-language-server"
command = "tailwindcss-language-server"
args = ["--stdio"]
# The server knows the id of HTML, not ours.
language-id = "html"
root-markers = ["tailwind.config.*", "package.json#dependencies.tailwindcss", "package.json#devDependencies.tailwindcss"]
require-root-marker = true
install-hint = "npm i -g @tailwindcss/language-server"
# Rainbow brackets › angle: the markup's tags.
[rainbow-brackets]
tags = ["OpenTag", "CloseTag", "SelfClosingTag"]