Skip to content

About

Jinja2 Enhanced Support

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

Repository files navigation

Jinja2 Enhanced Support

Version Static Badge

Professional-grade Jinja2 template support for JetBrains IDEs with comprehensive syntax analysis, intelligent error detection, advanced language features, and a rich Extension API for framework integrations.

Features

Language Core

Area Coverage Details
Language Registration 90% FileType, file extensions, template language, language substitution
Lexer 100% {{ }}, {% %}, {# #}, identifiers, keywords, strings, numbers, operators, punctuation, whitespace-control tokens ({{-, -}}, {%-, -%})
Parser 90% Expressions, statements, filters, tests, calls, macros, blocks, imports, assignments, control flow
PSI Model 85% File, expression, statement, variable, macro, block, filter, test, import, include, reference PSI

Expression Support (100%)

  • Literals: strings, numbers, booleans, none, lists, tuples, dicts
  • Variables and attribute access: foo.bar, foo["bar"]
  • Function calls, arithmetic, comparisons, boolean/membership operators
  • Filters (|), tests (is), conditional expressions (x if cond else y)

Statement Support (100%)

if/elif/else/endif, for/endfor, set, block/endblock, extends, include, import, from...import, macro/endmacro, call/endcall, filter/endfilter, with/endwith, raw/endraw

Syntax Highlighting (85%)

  • Delimiters, keywords, identifiers, variables, strings, numbers, operators
  • Filter and test highlighting, macro and comment highlighting
  • Custom color schemes for Default and Darcula themes

Code Completion (85%)

  • Keywords, statements, scope-aware variables
  • Built-in filters (50+), tests (20+), globals
  • Macros, macro parameters, blocks
  • Template paths for include, extends, import

Navigation (80%)

  • Go to declaration / definition
  • Find usages
  • Go to macro, block, included/imported/parent template

Inspections (65%)

Inspection Status
Undefined variable Done
Unknown filter / test Done
Duplicate macro Done
Unused variable / macro Done
Invalid inheritance Done
Unknown macro Partial
Invalid macro invocation Partial
Missing template Planned
Wrong argument count Planned
Duplicate block Planned
Shadowed variable Planned
Unreachable branch Planned

Quick Fixes (15%)

Planned: add missing end-tag, create macro/template, import macro, correct filter/test name, remove unused declaration, rename unresolved symbol.

Refactoring (20%)

  • Find usages before delete — done
  • Rename variable/macro/block/imported symbol — planned
  • Safe delete, conflict detection — planned

Template Inheritance (80%)

  • extends and parent template resolution
  • Child template relationships, block override detection
  • super() support, block hierarchy, inheritance navigation

Imports and Includes (85%)

  • include with/without context, ignore missing
  • import, from...import, macro namespace resolution

Editor Features (80%)

  • Matching tag highlighting (if ↔ endif, for ↔ endfor, etc.)
  • Auto-close blocks, comment/uncomment, brace matching
  • Indentation support, smart Enter

Code Folding (95%)

All block structures: if, for, macros, blocks, filter blocks, raw blocks, large comments.

Formatter (90%)

  • Indentation, nested blocks, spaces inside {{ }}/{% %}
  • Operator and filter formatting, macro parameters
  • Configurable Code Style settings (Ctrl+Alt+L / Cmd+Alt+L)

Quick Documentation (80%)

Ctrl+Q / F1 — documentation for keywords, statements, filters, tests, globals, macros, user variables, template references.

Scope Model (60%)

  • Global, template, loop, macro scopes — working
  • Block, call, with scopes — planned
  • Imported scope and shadowing rules — partial

Symbol Resolution (75%)

Local variables, set/for variables, loop special variable, macro arguments, imported macros/variables, block and template references, globals.

Built-in Jinja2 Model (85%)

  • Filters (50+): 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
  • Tests (20+): 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
  • Global functions: range, lipsum, dict, cycler, joiner, namespace
  • Loop object: 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

Jinja Environment Configuration (90%)

Custom variable/block/comment delimiters, trim_blocks, lstrip_blocks, line statements, line comments.

Embedded Language Support (40%)

Host Language Coverage
HTML + Jinja 70%
YAML + Jinja 60%
Plain text + Jinja 60%
JSON + Jinja 20%
XML + Jinja 20%
CSS + Jinja 10%
JavaScript + Jinja 10%
Shell + Jinja 10%

Live Templates

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...

Extension API

A rich set of extension points for framework integrations and third-party plugins.

API Coverage Extension Points
Globals / Functions 60% FunctionProvider
Variable Provider 95% VariableProvider, ScopeVariableProvider, AssignmentTagProvider
Filter API 95% FilterProvider (deprecation, custom resolve, return type)
Test API 90% TestProvider (deprecation metadata)
Callable API 80% MacroModuleProvider
Object / Type Model 75% TypeSchemaProvider, DynamicTypeProvider
Template Root Provider 85% TemplateRootProvider
Template Resolver 85% Jinja2TemplateResolver
Symbol Provider 70% VariableProvider, MacroModuleProvider, AssignmentTagProvider
Reference Resolver 85% MacroModuleProvider, AssignmentTagProvider
Completion Provider 100% CompletionContributor, Original Position Context
Documentation Provider 90% DocumentationProvider
Inspection API 80% InspectionRuleProvider, AssignmentTagProvider
Quick Fix API 20% Jinja2QuickFixProvider
Context Provider 70% Jinja2ApiConfigProvider, ScopeVariableProvider
Language Environment 95% Jinja2ApiConfigProvider, DelimiterProvider
Jinja Extension (custom tags) 90% TagBehaviorProvider, AssignmentTagProvider
File Context 60% InjectionLanguageProvider, LiveTemplateContextProvider
Host Language 70% InjectionLanguageProvider
Navigation 80% AssignmentTagProvider, DynamicTypeProvider, FilterProvider
Usage / Search 80% AssignmentTagProvider
Type Inference 80% TypeSchemaProvider, ScopeVariableProvider, DynamicTypeProvider, FilterProvider
Index Contribution 70% SymbolIndexContributor
Metadata Source 15% MetadataSource, static JSON, project metadata files
Lifecycle / Cache 75% Jinja2ProviderLifecycle
Rename / Refactoring 10% Planned
Compatibility 10% Planned

Provider file scoping: Filter/Test/Function providers can limit descriptors to specific host files.

Installation

From JetBrains Marketplace

  1. Open IDE Settings → Plugins
  2. Search for "Jinja2 Enhanced Support"
  3. Click Install
  4. Restart IDE

Configuration

Language Injection Settings

Settings → Tools → Jinja2 Language Injection

  • Enable/disable global injection
  • Add file extensions (.html, .yml, .yaml, .xml, .txt)
  • Per-file injection control

Code Style Settings

Settings → Editor → Code Style → Jinja2

  • Tabs and Indents: indent size, continuation indent
  • Spaces: around operators, after commas
  • Blank Lines: between sections

Context Actions

Right-click in editor:

  • Enable Jinja2 Highlighting — enable for current file
  • Associate with Jinja2 Enhanced — change file type association

Compatibility

  • 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

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support


Made with ❤ by SomeBlackMagic

About

Jinja2 Enhanced Support

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages