Professional-grade Jinja2 template support for JetBrains IDEs with comprehensive syntax analysis, intelligent error detection, and advanced language features.
- Full lexical analysis with 120+ token types
- Whitespace control syntax support (
{{-,-%},{%-,-}}) - Context-aware identifier classification (filters, tests, macros, blocks)
- Custom color schemes for Default and Darcula themes
- Context-aware autocomplete:
- Filters after
|operator - Tests after
iskeyword - Macro names after
callkeyword - Block names in
block/endblock
- Filters after
- Smart insert handlers with automatic
()insertion - Template expansion for control structures
- 50+ built-in filters and 20+ tests
- Multiline folding for all block structures:
for/endfor,if/elif/else/endifmacro/endmacro,block/endblockcall/endcall,filter/endfilterwith/endwith,set/endsetautoescape/endautoescape,raw/endraw- Comments
{# ... #}
- Smart placeholder text generation
- Advanced delimiter validation (
{{,}},{%,%},{#,#}) - Unclosed block detection (missing
endif,endfor, etc.) - Unclosed comment detection
- Whitespace control syntax validation
- Mismatched opening/closing tags
- Proper nesting validation
- Undefined variable detection - warns about undeclared variables
- Undefined macro detection - identifies calls to non-existent macros
- Duplicate macro names - prevents naming conflicts
- Recognizes common context variables (
loop,self,super,varargs,kwargs)
- Unknown filter warnings - validates against 56+ known filters
- Iteration over non-iterable values - detects
forloops over numbers - Type mismatch detection
- Unused macro detection - identifies macros that are never called
- Unused variable warnings - finds variables that are declared but not used
- Unused macro parameter detection - detects parameters not referenced in macro body
- Configurable code style settings:
- Indentation (spaces/tabs, size)
- Spacing around operators
- Blank lines configuration
Ctrl+Alt+L(Windows/Linux) orCmd+Alt+L(macOS) reformatting- Preserves template structure
- Press
Ctrl+Q(Windows/Linux) orF1(macOS) - Comprehensive documentation with:
- Parameter signatures
- Return types
- Usage examples
- Coverage for 50+ filters and 20+ tests
Rapid development with predefined snippets:
forβ{% for item in items %}...{% endfor %}ifβ{% if condition %}...{% endif %}macroβ{% macro name(params) %}...{% endmacro %}blockβ{% block name %}...{% endblock %}- And more...
abs, attr, batch, capitalize, center, default, dictsort, escape, filesizeformat, first, float, format, groupby, indent, int, join, last, length, list, lower, map, max, min, pprint, random, reject, rejectattr, replace, reverse, round, safe, select, selectattr, slice, sort, string, striptags, sum, title, tojson, trim, truncate, unique, upper, urlencode, urlize, wordcount, wordwrap, xmlattr, and more
callable, defined, divisibleby, equalto, escaped, even, false, filter, float, ge, gt, iterable, le, lower, lt, mapping, ne, none, number, odd, sameas, sequence, string, test, true, undefined, upper
range, lipsum, dict, cycler, joiner, namespace
for/endfor- Loops with else supportif/elif/else/endif- Conditionalsmacro/endmacro- Reusable template functionsblock/endblock- Template inheritance blockscall/endcall- Macro calls with caller supportfilter/endfilter- Apply filter to block contentset/endset- Variable assignment (inline and block)with/endwith- Scoped contextautoescape/endautoescape- Escape controlraw/endraw- Raw output without processing
extends- Template inheritanceinclude- Include other templatesimport- Import macros from other templatesfrom ... import- Selective macro imports
loop.index, loop.index0, loop.revindex, loop.revindex0, loop.first, loop.last, loop.length, loop.cycle, loop.depth, loop.depth0, loop.previtem, loop.nextitem, loop.changed
- Proper nesting detection for all block types
- Ensures correct pairing of opening/closing tags
- Validates
elif/elsewithin properif/forcontext
Automatically distinguishes between:
{# Inline set #}
{% set x = value %}
{# Block set #}
{% set content %}
...multi-line content...
{% endset %}Correctly handles if in different contexts:
{# Block-level if #}
{% if condition %}...{% endif %}
{# Inline if expression #}
{% set x = value if condition else other %}
{{ item if condition else default }}- Arithmetic:
+,-,*,/,//,%,** - Comparison:
==,!=,<,>,<=,>= - Logical:
and,or,not - String concatenation:
~ - Membership:
in,not in - Identity:
is,is not
Handles Jinja2 in structured formats:
# YAML with Jinja2
key: |
{% for item in items %}
- {{ item }}
{% endfor %}- Open IDE Settings β Plugins
- Search for "Jinja2 Enhanced Support"
- Click Install
- Restart IDE
Settings β Tools β Jinja2 Language Injection
Configure automatic Jinja2 detection:
- Enable/disable global injection
- Add file extensions (
.html,.yml,.yaml,.xml,.txt) - Per-file injection control
Settings β Editor β Code Style β Jinja2
Customize formatting:
- Tabs and Indents: Indent size, continuation indent
- Spaces: Around operators, after commas
- Blank Lines: Between sections
Right-click in editor:
- Enable Jinja2 Highlighting - Enable for current file
- Associate with Jinja2 Enhanced - Change file type association
- IDE Version: 2022.3+ (build 223.0 - 253.*)
- Supported IDEs:
- IntelliJ IDEA (Community, Ultimate)
- PyCharm (Community, Professional)
- WebStorm
- PhpStorm
- RubyMine
- GoLand
- CLion
- All other JetBrains IDEs with Python support
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- β Complete Jinja2 3.1.x language support
- β Stack-based parser with AST generation
- β Syntax error detection with delimiter validation
- β Semantic analysis (undefined variables/macros)
- β Logical error inspections (unknown filters, non-iterable iteration)
- β Code quality inspections (unused constructs)
- β Context-aware code completion
- β AST-based code folding
- β Multi-host language injection
- β Code formatting & style
- β Quick documentation
- β Dynamic extension API
- β Whitespace control support
- β Smart parsing (inline vs block constructs)
- β Context menu actions
Made with β€οΈ by SomeBlackMagic