Local Extension Testing¶
Test the extension in your local VS Code before opening a pull request or publishing.
Install dependencies¶
Run from the repository root:
just init installs the Node toolchain, the VS Code extension build tools, the locked
Python generator environment, and the prek git hooks (pre-commit and pre-push) that run
lint, type, format, and test checks automatically. The manual equivalent is:
npm install
uv sync --project tools --frozen --all-groups
uv run --project tools prek install --hook-type pre-commit --hook-type pre-push
Run the automated checks¶
The fastest way to verify logic is the command set used in CI:
npm run lintruns ESLint over the TypeScript source.npm run check-typesrunstsc --noEmit.npm run test:unitcompiles the source and runs the Node unit tests inout/test/*.test.js.npm run test:extensioncompiles, bundlesdist/extension.js, downloads VS Code 1.90.2, installs thebatisteo.vscode-djangodependency, and runs the extension-host smoke suite.
To run the full test surface, including Python generator tests and snippet validation:
This also runs check-snippets and pytest under tools/.
Debug interactively with F5¶
For day-to-day development, run the extension inside a real Extension Development Host:
- Open the repository in VS Code.
- Press F5 (or choose Run → Start Debugging).
- Select the launch configuration named "Run Extension (F5)".
The existing .vscode/launch.json configuration loads the workspace at ${workspaceFolder}/examples in a new VS Code window with your local extension activated. You can set breakpoints in the TypeScript source, inspect variables, and watch the Output panel while the extension runs.
{
"name": "Run Extension (F5)",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/examples"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: compile"
}
Use this mode to iterate on activation, completions, hover, diagnostics, and Django partial behavior.
Test the packaged VSIX¶
A packaged VSIX is the artifact users install. Test it locally to catch missing files, packaging errors, or behavior that only works in the source tree:
If you use VS Code profiles, this installs into the
default profile's extension pool, not necessarily the profile your workspace is bound to. Check which
profile is active (Status Bar → profile name) and, if it isn't "Default", reinstall with --profile "<your-profile-name>" so the extension shows up in that window's Extensions view.
Open the examples/ workspace (or any HTML/Django template project) and run through this smoke checklist:
- Open an
HTMLfile and type<div hx. Confirmhx-get,hx-post, and other attributes appear. - Type
<div data-hx. Confirmdata-hx-getaliases appear. - Hover a known attribute such as
hx-get. Confirm documentation, version badges, and HTMX doc links appear. - Hover an ordinary HTML attribute such as
class. Confirm no HTMX hover text appears. - Type a misspelled attribute such as
hx-methd. Confirm a diagnostic appears. - Press
Ctrl/Cmd+.on the diagnostic. Confirm quick fixes such as "Replace with 'hx-method'" and "Replace with 'data-hx-method'" are offered. - Open a
django-htmlfile with{% partialdef card inline %}and{% partial card %}. Confirm completion and go-to-definition work for local partials. - Try the partial rename with
F2. Confirm both the definition and the call update.
Inspect extension output¶
When something behaves differently than expected, open Output → HTMX Django IntelliSense in the host VS Code window. The channel logs activation events, catalog loading, and runtime errors.
Common local-testing issues:
- No completions or hover: confirm the document language mode is HTML or Django HTML. For Django templates, install and enable
batisteo.vscode-django, then reload the window. - Django partials do not resolve: confirm the Django extension is installed and the file is recognized as
django-html. - Extension does not activate: check the Output panel for a catalog-load error. If
htmx.catalog.jsonis missing from the VSIX, reinstall the extension or rebuild withnpm run package.
When you are done¶
After local testing passes, run the full CI verification checklist before pushing: