Skip to main content

VS Code Integration

The Anvil VS Code extension provides real-time feedback directly in your editor.

Installation

From Marketplace

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for "Anvil"
  4. 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:

  1. Click the lightbulb (or Ctrl+.)
  2. 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":

SettingDescriptionDefault
anvil.enableEnable/disable extensiontrue
anvil.configPathPath to config fileanvil.config.json
anvil.validateOnSaveRun on savetrue
anvil.validateOnTypeRun while typingfalse
anvil.debounceMsDelay before validation300

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):

CommandDescription
Anvil: RunRun Anvil on current file
Anvil: Run AllRun Anvil on entire workspace
Anvil: ToggleEnable/disable Anvil
Anvil: Show OutputView Anvil output channel
Anvil: Clear CacheClear validation cache

Keyboard Shortcuts

Default shortcuts:

ShortcutCommand
Ctrl+Shift+ARun Anvil on current file
Ctrl+Alt+AToggle Anvil

Customise in Keyboard Shortcuts.

Output Channel

View detailed logs:

  1. View → Output (or Ctrl+Shift+U)
  2. 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

  1. Check Output channel for errors
  2. Verify anvil.config.json exists
  3. Run Anvil: Show Output

Diagnostics Not Appearing

  1. Ensure anvil.enable is true
  2. Check file is in workspace
  3. Verify file type is supported

Performance Issues

  1. Increase debounceMs
  2. Disable validateOnType
  3. Add large directories to ignore list

Next: MCP integration →