[BUG] /terminal-setup writes keybindings to VSCode config instead of the actual connected IDE (Antigravity, Cursor, Windsurf, etc.)

Resolved 💬 4 comments Opened Mar 12, 2026 by ohing504 Closed Apr 10, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code
Note: Previously reported as #12848 (Antigravity) and #9160 (Windsurf), both auto-closed due to inactivity without a fix. The bug still exists in v2.1.74.

What's Wrong?

The /terminal-setup command always writes the Shift+Enter keybinding to the VSCode config directory (~/Library/Application Support/Code/User/keybindings.json), even when Claude Code is connected to and running inside a different VSCode-based IDE (e.g., Google Antigravity).

This happens because the IDE detection logic relies on TERM_PROGRAM, which VSCode forks inherit as "vscode" regardless of the actual IDE.

Root cause from binary analysis:

The keybinding install function correctly maps IDE names to config paths:

// Pseudocode reconstructed from binary strings analysis
let dirName = ideName === "VSCode" ? "Code" : ideName;
let configPath = path.join(os.homedir(), "Library", "Application Support", dirName, "User", "keybindings.json");

The function itself handles arbitrary IDE names properly — if "Antigravity" were passed, it would correctly write to ~/Library/Application Support/Antigravity/User/keybindings.json. The bug is in the caller that always resolves the IDE name as "VSCode" because TERM_PROGRAM=vscode.

Environment evidence from inside Antigravity terminal:

| Variable | Value | Notes |
|----------|-------|-------|
| TERM_PROGRAM | vscode | ❌ Inherited from VSCode, misleading |
| __CFBundleIdentifier | com.google.antigravity | ✅ Actual IDE |
| GIT_ASKPASS | .../Antigravity.app/.../askpass.sh | ✅ Actual IDE |
| VSCODE_GIT_ASKPASS_NODE | .../Antigravity Helper (Plugin).app/... | ✅ Actual IDE |
| PATH entries | .antigravity/antigravity/bin | ✅ Actual IDE |

What Should Happen?

/terminal-setup should:

  1. Detect the actual IDE, not rely solely on TERM_PROGRAM
  2. Use disambiguating signals like __CFBundleIdentifier, GIT_ASKPASS path, or the app bundle name in VSCODE_GIT_ASKPASS_NODE
  3. Write keybindings to the correct IDE's config directory (e.g., ~/Library/Application Support/Antigravity/User/keybindings.json)

Error Messages/Logs

# Running /terminal-setup inside Antigravity IDE terminal:

❯ /terminal-setup
Found existing VSCode terminal Shift+Enter key binding. Remove it to continue.
See /Users/ohing/Library/Application Support/Code/User/keybindings.json

# It checks VSCode's keybindings.json, not Antigravity's.
# Antigravity's keybindings.json at ~/Library/Application Support/Antigravity/User/keybindings.json
# is never read or written.

Steps to Reproduce

  1. Install Google Antigravity IDE (or any other VSCode fork like Cursor, Windsurf, VSCodium)
  2. Open a terminal inside Antigravity
  3. Connect Claude Code to the IDE with /ide
  4. Run /terminal-setup
  5. Observe: message says "VSCode terminal Shift+Enter key binding" and points to Application Support/Code/User/keybindings.json
  6. Press Shift+Enter in the terminal — it does not insert a newline (the keybinding was written to VSCode's config, not Antigravity's)

Workaround: Manually create/copy the keybindings file to the correct IDE config directory:

# For Antigravity:
cp ~/Library/Application\ Support/Code/User/keybindings.json \
   ~/Library/Application\ Support/Antigravity/User/keybindings.json

# Or create it directly:
cat > ~/Library/Application\ Support/Antigravity/User/keybindings.json << 'JSONEOF'
[
    {
        "key": "shift+enter",
        "command": "workbench.action.terminal.sendSequence",
        "args": { "text": "\^[\r" },
        "when": "terminalFocus"
    }
]
JSONEOF

Suggested Fix

Instead of relying on TERM_PROGRAM alone, use a detection cascade:

function detectIDEName() {
  // 1. macOS: Check CFBundleIdentifier (most reliable)
  const bundleId = process.env.__CFBundleIdentifier;
  if (bundleId) {
    if (bundleId.includes('antigravity')) return 'Antigravity';
    if (bundleId.includes('cursor')) return 'Cursor';
    if (bundleId.includes('windsurf')) return 'Windsurf';
    if (bundleId.includes('vscodium')) return 'VSCodium';
    if (bundleId.includes('vscode')) return 'VSCode';
  }
  
  // 2. Check GIT_ASKPASS or VSCODE_GIT_ASKPASS_NODE for app name
  const askpass = process.env.GIT_ASKPASS || process.env.VSCODE_GIT_ASKPASS_NODE || '';
  const appMatch = askpass.match(/\/Applications\/([^/]+)\.app\//);
  if (appMatch) return appMatch[1];

  // 3. Fallback to TERM_PROGRAM
  if (process.env.TERM_PROGRAM === 'vscode') return 'VSCode';
  
  return null;
}

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Claude Code Version

2.1.74 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

  • Affected IDEs: Any VSCode fork — Google Antigravity, Cursor, Windsurf, VSCodium, etc.
  • Previously reported: #12848 (Dec 2025, Antigravity), #9160 (Oct 2025, Windsurf) — both auto-closed without fix
  • macOS config paths follow the pattern: ~/Library/Application Support/{IDE_NAME}/User/keybindings.json
  • VSCode → Code
  • Antigravity → Antigravity
  • Cursor → Cursor
  • Windsurf → Windsurf
  • Linux: ~/.config/{IDE_NAME}/User/keybindings.json
  • Windows: %APPDATA%/{IDE_NAME}/User/keybindings.json
  • The /ide connection already knows the actual IDE — the fix could also leverage that info when /terminal-setup runs.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗