claude-code - 💡(How to fix) Fix VS Code extension: hardcoded 3000ms shell-integration wait causes ~5s delay clicking extension icon [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49496Fetched 2026-04-17 08:39:29
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×3commented ×2mentioned ×1subscribed ×1

Root Cause

Root cause

Fix Action

Fix / Workaround

claudeCode.useTerminal: false (webview) is a workaround but many some users (me) prefer the terminal path.

Code Example

await new Promise((resolve) => {
    onDidChangeTerminalShellIntegration((event) => {
      if (event.terminal === term) {
        onDidStartTerminalShellExecution((exec) => {
          if (exec.terminal === term) resolve();
        });
        event.shellIntegration.executeCommand("claude");
      }
    });
    setTimeout(() => {
      if (!term.shellIntegration) { term.sendText("claude"); resolve(); }
    }, 3000);
  });
RAW_BUFFERClick to expand / collapse

Environment

  • macOS 15.x (darwin-arm64), VS Code stable
  • Claude Code extension [email protected]
  • zsh with working shell integration (OSC 633 markers confirmed, blue gutter decorations visible)
  • Setting claudeCode.useTerminal: true

Repro

  1. Click the Claude Code icon in the VS Code activity bar
  2. A terminal opens
  3. ~5 seconds pass before claude is typed into the terminal

Root cause

Reading extension.js in the packaged extension, the openTerminal path creates a terminal and awaits a promise with a hardcoded 3000ms fallback:

  await new Promise((resolve) => {
    onDidChangeTerminalShellIntegration((event) => {
      if (event.terminal === term) {
        onDidStartTerminalShellExecution((exec) => {
          if (exec.terminal === term) resolve();
        });
        event.shellIntegration.executeCommand("claude");
      }
    });
    setTimeout(() => {
      if (!term.shellIntegration) { term.sendText("claude"); resolve(); }
    }, 3000);
  });

With the happy path, the promise resolves on onDidStartTerminalShellExecution — which only fires after executeCommand runs, adding real delay on top of extension activation.

Verified locally:

  • time zsh -i -c exit → 350ms
  • time claude --version → 50ms
  • Python ext venv auto-activation disabled
  • direnv output silenced — no interference with integration markers
  • Still ~5s from click to claude being typed

Request

Please either:

  1. Make the 3000ms timeout configurable (claudeCode.shellIntegrationTimeoutMs), or
  2. Short-circuit: if terminal.shellIntegration is already present after createTerminal, call executeCommand immediately without waiting for the event.

claudeCode.useTerminal: false (webview) is a workaround but many some users (me) prefer the terminal path.

extent analysis

TL;DR

The issue can be resolved by making the 3000ms timeout configurable or short-circuiting the execution of the executeCommand if terminal.shellIntegration is already present.

Guidance

  • The current implementation has a hardcoded 3000ms fallback, which is causing a delay of around 5 seconds before "claude" is typed into the terminal.
  • To mitigate this, the claudeCode.shellIntegrationTimeoutMs setting could be introduced to make the timeout configurable, allowing users to adjust the delay to their needs.
  • Alternatively, the code could be modified to short-circuit the execution of executeCommand if terminal.shellIntegration is already present after creating the terminal, eliminating the need for the timeout.
  • Verifying the fix would involve checking the time it takes for "claude" to be typed into the terminal after clicking the Claude Code icon, and ensuring it is significantly less than 5 seconds.

Example

// Potential short-circuit implementation
if (term.shellIntegration) {
  term.shellIntegration.executeCommand("claude");
} else {
  await new Promise((resolve) => {
    onDidChangeTerminalShellIntegration((event) => {
      if (event.terminal === term) {
        onDidStartTerminalShellExecution((exec) => {
          if (exec.terminal === term) resolve();
        });
        event.shellIntegration.executeCommand("claude");
      }
    });
    setTimeout(() => {
      if (!term.shellIntegration) { term.sendText("claude"); resolve(); }
    }, claudeCode.shellIntegrationTimeoutMs);
  });
}

Notes

The provided solution assumes that the claudeCode.shellIntegrationTimeoutMs setting or the short-circuit approach would be implemented in the extension code. The exact implementation details may vary depending on the extension's architecture and requirements.

Recommendation

Apply a workaround by setting claudeCode.useTerminal to false and using the webview path, as this is a known working alternative, until a more permanent fix can be implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix VS Code extension: hardcoded 3000ms shell-integration wait causes ~5s delay clicking extension icon [2 comments, 2 participants]