Skip to main content

VS Code Extension

The extension shows policy violations inline as you code — same visual style as TypeScript errors and ESLint.

Requirements

VS Code 1.85 or later.

Install

  1. Open VS Code
  2. Extensions sidebar (Cmd+Shift+X / Ctrl+Shift+X)
  3. Search for “MergeGuide”
  4. Click Install
Or via CLI:
code --install-extension mergeguide.mergeguide-vscode

Real-time Diagnostics

Policy violations appear inline as you type:
  • Red squiggles = error-severity (blocks commit)
  • Yellow squiggles = warnings
  • Blue squiggles = info
Hover to see policy name, violation reason, and suggested fixes.

Problems Panel

All violations in your workspace appear in the Problems panel (Cmd+Shift+M), grouped by severity and file.

Quick Fixes

Many violations offer automatic fixes:
  1. Click the lightbulb icon or press Cmd+.
  2. Select from available options:
    • Fix this violation — Apply suggested fix
    • Ignore this line — Add inline ignore comment
    • Ignore this file — Add to .mergeguide.yaml ignore patterns
The MergeGuide sidebar (activity bar) includes three panels:
  • Policy Violations — All current violations in the workspace
  • Policies — Available policies and their enabled state
  • Evaluations — History of evaluation runs

Status Bar

Shows current check status and violation count for the active file. Click to view details.

Pre-commit Integration

The extension installs a shell-based git pre-commit hook. When enabled, policy checks run before every commit — the same checks that run in CI, at the point where fixes are cheapest.

Commands

Access via Command Palette (Cmd+Shift+P):
CommandDescription
MergeGuide: Check Current FileRun check on active file
MergeGuide: Check All Files in WorkspaceCheck entire workspace
MergeGuide: Reload PoliciesRefresh policy cache from API
MergeGuide: Set API KeySecurely store API key in VS Code SecretStorage
MergeGuide: Clear API KeyRemove stored API key
MergeGuide: Check Authentication StatusVerify API key and connection
MergeGuide: Pre-Commit Policy CheckRun check manually as pre-commit step
MergeGuide: Install Pre-commit HookInstall shell-based git hook
MergeGuide: Uninstall Pre-commit HookRemove git hook
MergeGuide: Navigate to ViolationJump to violation location in code
MergeGuide: Refresh ViolationsReload violations panel
MergeGuide: Refresh EvaluationsReload evaluations panel

Configuration

Open Settings (Cmd+,) and search for “MergeGuide”:
SettingDescriptionDefault
mergeguide.enableEnable/disable policy checkingtrue
mergeguide.debounceMsDelay before checking (ms)300
mergeguide.maxFileSizeKbSkip files larger than this (KB)1024
mergeguide.preCommitHookHook behavior: prompt, always, neverprompt
mergeguide.preCommitCheckEnable pre-commit policy checktrue
mergeguide.preCommitBlockOnErrorsBlock commit on error-severity violationstrue
mergeguide.apiUrlMergeGuide API base URLhttps://portal.mergeguide.ai
mergeguide.policyCacheTtlMsPolicy cache TTL (ms)300000 (5 min)
mergeguide.trace.serverLanguage server trace: off, messages, verboseoff

Workspace Settings

Create .vscode/settings.json:
{
  "mergeguide.enable": true,
  "mergeguide.debounceMs": 500,
  "mergeguide.preCommitHook": "always"
}

Authentication

Set your API key via the Command Palette:
  1. Cmd+Shift+PMergeGuide: Set API Key
  2. Paste your API key
  3. Key is stored in VS Code SecretStorage (not plain text settings)
Or authenticate via CLI first — the extension reads credentials from the CLI credential store:
mergeguide auth login

Supported Languages

The extension activates for files in these languages: Python, JavaScript, TypeScript (including JSX/TSX), Java, Go, PHP, Ruby, C#, Kotlin, Swift, Rust, C, C++, Terraform, Dockerfile All 15 languages are supported. Detection coverage follows your organization’s active policies.

Troubleshooting

Extension Not Working

  1. Check Output panel (View > Output > MergeGuide)
  2. Verify authentication: MergeGuide: Check Authentication Status
  3. Confirm extension is enabled for the workspace

Diagnostics Not Appearing

  1. Open a file in a supported language
  2. Check that mergeguide.enable is true
  3. Run MergeGuide: Reload Policies to refresh from API

Performance

If the extension is slow on large files:
{
  "mergeguide.debounceMs": 1000,
  "mergeguide.maxFileSizeKb": 512
}

Reset Extension

  1. Run MergeGuide: Clear API Key
  2. Disable and re-enable the extension
  3. Restart VS Code