VS Code Integration
The Anvil VS Code extension provides real-time feedback directly in your editor.
Installation
From Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Anvil"
- Click Install
From CLI
code --install-extension eddacraft.anvil-vscode
Features
Inline Diagnostics
Issues appear as squiggly underlines in your code:
- Red — errors (gate failures)
- Yellow — warnings (anti-patterns)
- Blue — info (suggestions)
Hover for details and quick fixes.
Problems Panel
All issues appear in the Problems panel (Ctrl+Shift+M / Cmd+Shift+M):
PROBLEMS (2)
src/api/users.ts
⚠ [AP-003] Explicit 'any' type - line 42
src/services/auth.ts
⚠ [AP-006] Empty catch block - line 87
Quick Fixes
Some issues have automatic fixes:
- Click the lightbulb (or Ctrl+.)
- Select the fix
Available quick fixes:
- Add type annotation (AP-003)
- Add error logging (AP-006)
- Add suppression with placeholder
Status Bar
The status bar shows current Anvil status:
- ✓ Anvil — all clear
- ⚠ Anvil (2) — 2 warnings
- ✗ Anvil (1) — 1 error
Click for quick actions.
Code Actions
Right-click context menu:
- Anvil: Suppress this issue
- Anvil: Run check on file
- Anvil: View evidence
Configuration
Extension Settings
Open Settings (Ctrl+, / Cmd+,) and search for "Anvil":
| Setting | Description | Default |
|---|---|---|
anvil.enable | Enable/disable extension | true |
anvil.configPath | Path to config file | anvil.config.json |
anvil.validateOnSave | Run on save | true |
anvil.validateOnType | Run while typing | false |
anvil.debounceMs | Delay before validation | 300 |
Workspace Settings
Configure per-workspace in .vscode/settings.json:
{
"anvil.enable": true,
"anvil.validateOnSave": true,
"anvil.debounceMs": 500
}
Commands
Access via Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command | Description |
|---|---|
Anvil: Run | Run Anvil on current file |
Anvil: Run All | Run Anvil on entire workspace |
Anvil: Toggle | Enable/disable Anvil |
Anvil: Show Output | View Anvil output channel |
Anvil: Clear Cache | Clear validation cache |
Keyboard Shortcuts
Default shortcuts:
| Shortcut | Command |
|---|---|
Ctrl+Shift+A | Run Anvil on current file |
Ctrl+Alt+A | Toggle Anvil |
Customise in Keyboard Shortcuts.
Output Channel
View detailed logs:
- View → Output (or Ctrl+Shift+U)
- Select "Anvil" from dropdown
Useful for debugging configuration issues.
Integration with Other Extensions
ESLint
Anvil complements ESLint—they run independently:
- ESLint shows style/semantic issues
- Anvil shows architecture/pattern issues
Both appear in Problems panel.
Prettier
Anvil doesn't interfere with Prettier formatting.
GitLens
Anvil evidence can be viewed alongside GitLens blame info.
Troubleshooting
Extension Not Loading
- Check Output channel for errors
- Verify
anvil.config.jsonexists - Run
Anvil: Show Output
Diagnostics Not Appearing
- Ensure
anvil.enableistrue - Check file is in workspace
- Verify file type is supported
Performance Issues
- Increase
debounceMs - Disable
validateOnType - Add large directories to ignore list
Next: MCP integration →