Editor Setup
● Intermediate5 minBefore this: Install
The Kavach extension for VS Code, Cursor and other VS Code-based editors colors code and shows errors as you type.
What it gives
- Colors for
.kavfiles, and for```kavachblocks inside Markdown. - Errors and warnings as you type, with the same messages as
kavach check. The check runs on its own, so hover, completion and colors answer at once while a file is checked, and a check of text you have since changed is never shown. - Hover to see a value's type;
F12to go to where a name is declared. - Completion: the names in scope, and after a
.the value's fields and methods. - Names colored by where they come from: what a
usebrings in is lavender, the language's own methods (xs.push(2),s.len()) gold, and your own methods your theme's color. So a call shows whether it is the language's or the program's. - Quick fixes:
- "Mark
helperas agpu fn", when agpu fncalls a plain function that fits the GPU's rules. - Every fix that kavach fix makes, one at a time: "Remove this arm", "Remove this branch", "Write
==", "Declare it withlet", "Adduses Fs.read" and the rest. - Two that may not be what you meant, so they are offered, never made for you: "Change to
total" on a misspelled name, and "Change thetotaldeclared above" on aletthat hides another.
- "Mark
- Comment toggling, bracket matching, and
///continuing on Enter.
Install it
The extension isn't on the Marketplace yet: it is built from the repository, with no npm needed.
cargo build --release -p kavach-cli
sh scripts/package-vscode.sh
code --install-extension .kavach/kavach-vscode-0.2.0.vsix
- The first line builds
kavach(it needs Rust). On Windows, package withpowershell -File scripts/package-vscode.ps1. - If
kavachisn't on yourPATH, set Kavach: Path in the settings to the program the first line built. - Reload the window (
Ctrl+Shift+P, Developer: Reload Window). - Check it: write
const x: Int = "text"in a.kavfile, and a red line appears.