Skip to content

About

Offline HTMX 2/4 IntelliSense, diagnostics, and Django 6 template partials for VS Code

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

146 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTMX Django IntelliSense

Offline HTMX IntelliSense for Django templates.

Completions, hover documentation, diagnostics, quick fixes, and snippets for HTMX 2 and 4 in VS Code, plus completion, navigation, and rename for Django 6 template partials. Everything runs from a committed catalog with no network requests.

VS Marketplace Open VSX HTMX 2.0.11 | 4.0.0 Django 6 partials VS Code 1.90+ Documentation CI Ask DeepWiki Apache 2.0 license

Documentation · Installation · Why · Features · Settings · Development

HTMX Django IntelliSense in 30 seconds: hx-* attribute completion, context-aware trigger and swap values, hover documentation, diagnostics with one-keystroke quick fixes, Django 6 partial completion, go to definition and rename, and Django-ready snippets

Installation

Install HTMX Django IntelliSense from the Visual Studio Marketplace or Open VSX, or from the Quick Open palette (Ctrl/Cmd+P):

ext install difegam3.htmx-django-intellisense

Alternatively, install a local VSIX from a checkout:

npm install
npm run package
code --install-extension htmx-django-intellisense-*.vsix --force

If you use VS Code profiles, this installs into the default profile's extension pool. If the extension doesn't show up in the Extensions view, check which profile your workspace uses and reinstall with --profile "<your-profile-name>".

Django template support requires the Django extension, which VS Code installs as an extension dependency. Open an html or django-html template and type hx- to verify activation.

Read the full documentation for guides on authoring HTMX, Django partials, configuration, testing, packaging, and releases.

Why HTMX Django IntelliSense

  • Both HTMX majors. One catalog covers HTMX 2.0.11 and 4.0.0. Version-specific attributes, values, and modifiers are labelled, and a single setting narrows suggestions to one major.
  • Context, not a word list. hx-swap, hx-trigger, and hx-target suggest the strategies, events, and modifiers that fit where the cursor is.
  • Mistakes caught as you type. Misspelled attributes, invalid documented values, deprecated attributes, and unknown partials are flagged with a quick fix.
  • Django 6 partials are first-class. {% partialdef %} and {% partial %} complete, navigate, rename, and resolve across template.html#partial references in templates and Python.
  • Django-ready snippets. CSRF-safe POST, delete, search, infinite scroll, modals, out-of-band swaps, and partial responses.
  • Offline. The extension reads its committed catalog and makes no runtime network requests.

Features

Attribute completion

Type hx- in HTML or Django HTML to see every HTMX attribute with its description and version availability. HTMX 4-only attributes are badged, and aliases, data-hx-*, and dynamic syntax such as hx-on:<event> complete too.

Typing hx- inside an input opens the attribute list; typing g narrows it to hx-get with its HTMX 2 and 4 documentation, then hx-trigger is chosen from the hx-t matches

Context-aware values

Values are suggested for the attribute being edited. hx-trigger offers events and then modifiers such as changed and delay:, and hx-swap offers strategies, with HTMX 4 strategies such as innerMorph labelled, followed by modifiers such as transition:.

hx-trigger completes input, then the changed and delay: modifiers; hx-swap completes outerHTML from a strategy list that flags HTMX 4-only values, then transition:true

Hover documentation

Hover a recognized hx-* or data-hx-* attribute for its purpose, supported HTMX versions, categories, values and modifiers, an example, and links to the official HTMX 2 and HTMX 4 documentation.

Hovering hx-trigger shows HTMX 2 and 4 availability, its categories, a table of values and modifiers, an example, and links to the HTMX 2 docs, HTMX 4 docs, copy example, and settings

Diagnostics and quick fixes

The extension reports misspelled HTMX attributes, deprecated attributes, invalid documented values, and unknown or duplicate Django partials. Typos, deprecated attributes, invalid values, and unknown partials offer a fix from the Ctrl/Cmd+. lightbulb; duplicate partials and version mismatches are warnings only.

hx-boost=ture and hx-tirgger are underlined and listed in the Problems panel; the quick fixes Replace with hx-trigger and Replace with true clear both warnings

Django template partials

Definitions in the current template are offered after {% partial :

{% partialdef result_card inline %}
  <article id="result-{{ result.pk }}">{{ result.title }}</article>
{% endpartialdef %}

{% partial result_card %}

Find All References (Shift+F12) and Rename Symbol (F2) work across the workspace: the partialdef, every {% partial %} tag, {% include %} references, and Python view strings are listed and rewritten together. Ctrl/Cmd+click on the template path in any of those references opens the template file. Duplicate {% partialdef %} definitions are flagged with a quick fix to rename the later one.

Static cross-template references also complete and navigate from Django includes and common Python APIs:

{% include "results.html#result_card" %}
return render(request, "results.html#result_card", context)

{% partial res completes result_card, a render call in views.py completes results.html#result_card, F12 jumps to the partialdef, and F2 renames it to result_row in the template and the Python view at once

See the Django partials guide for lookup rules, diagnostics, and cross-template behavior.

Django snippets

Type a snippet prefix in a django-html document to insert a secure, Django-ready HTMX pattern, then Tab through its placeholders. See the snippet and example catalog for every prefix and its generated output.

Typing htmx-se offers the htmx-search snippet with a preview; accepting it inserts a debounced search input with tab stops for the name, URL name, delay, and target

Compatibility and settings

Requirement Supported
VS Code 1.90 or later
HTMX 2.0.11 and 4.0.0
Django Templates via batisteo.vscode-django; partials need 6.0+

compatible mode is the default and accepts the union of both HTMX versions. Choose 2 or 4 to surface cross-version syntax as hints.

Setting Default Purpose
htmxDjango.enableCompletion true Enable HTMX and Django partial completions.
htmxDjango.enableHover true Enable HTMX and partial hover information.
htmxDjango.enableValidation true Enable HTMX and same-file partial diagnostics.
htmxDjango.version compatible Use compatible, 2, or 4.

See the configuration guide and settings reference for details.

Development

This repository contains the TypeScript VS Code extension and a Python toolchain under tools/ that generates the offline HTMX catalog and snippets. Install uv, npm, and Just, then run:

just init
just verify

just init installs both toolchains and the prek git hooks. just verify runs the complete local CI checklist: linting, type checks, Python and TypeScript tests, artifact drift checks, extension-host tests, the docs build, VSIX packaging, and the Python package build.

Useful focused commands:

npm test
npm run test:extension
npm run package

After changing catalog inputs or snippet sources, regenerate the committed artifacts with npm run build-data or npm run build-snippets. See the first contribution guide and CI and packaging guide for the full workflow.

License

Licensed under Apache 2.0. Maintained independently at difegam/htmx-django-intellisense.

About

Offline HTMX 2/4 IntelliSense, diagnostics, and Django 6 template partials for VS Code

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages