hk for VS Code
Runs the checks and fixes from your project's hk.pkl with the hk CLI (must be on PATH, or set hk.path).
- hk sidebar listing every step with its pass or fail state and the hooks that run it
- Findings in the Problems panel, labelled with the step that reported them
- Check or fix everything, one step, or the current file
- A file is checked again when you save it
- "Fix this file with hk" quick fix on findings from steps that can fix
- Status bar count of failing steps
Findings
Steps with a diagnostic_format (most hk builtins) report exact locations, severities and rule links. For other steps the extension reads path:line[:col]: message lines from the step's output. A step that fails without either still shows as failed; click it to see its output.
Settings
| Setting |
Purpose |
hk.checkOnSave |
Check a file when you save it. On by default. |
hk.checkOnStartup |
Check every file when the workspace opens. Off by default. |
hk.extraArgs |
Extra arguments for hk check and hk fix, such as --profile slow. |
hk.timeout |
Kill a hung hk run. |
hk.path, hk.pklPath |
Paths to the hk and pkl executables. |
Fixes run with --no-stage, so they rewrite files but never stage them.
pkl is only needed to list the steps before the first run. Without it they appear once a check has run, and the fix buttons show for every step.
The extension is disabled in untrusted workspaces, because hk.pkl defines the commands that run.
Known limits: one hk.pkl per window (the first found at or above a workspace folder), and only the check and fix hooks are run.
Develop
bun install
bun run build # bundles to out/extension.js
bun run test:unit # bun tests
bun run test:integration # launches VS Code; needs hk, pkl and shellcheck
Press F5 ("Run hk") to launch an Extension Development Host on examples/.