claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Can't detect VS Code in integrated terminal on native Windows installation

Open thegrahamking opened this issue 6 months ago • 19 comments

Environment

  • Platform (select one):
    • [ ] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [x] Other: VS Code Extension v1.0.68
  • Claude CLI version: v1.0.68
  • Operating System: Windows 11 22H2 (OS Build 22621.5624)
  • Terminal: Windows Terminal w/ PowerShell 7.5.2

Bug Description

VS Code is not detected when running claude /ide in the integrated terminal or clicking the Claude Code button in VS Code

Steps to Reproduce

  1. Ensure VS Code - Claude Code extension is installed and up to date
  2. Open folder in VS Code
  3. Click Claude Code button
  4. Wait for CC to load/prompt to be available
  5. Enter /ide and press Enter

OR

  1. Ensure VS Code - Claude Code extension is installed and up to date
  2. Open folder in VS Code
  3. Open a new integrated terminal (Ctrl + Shift + ') / Terminal -> New Terminal
  4. Enter claude /ide and press Enter

Expected Behavior

VS Code is detected, selectable and can be connected to

Actual Behavior

VS Code is not detected

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                             │
│  Select IDE                                                                                                                 │
│  Connect to an IDE for integrated development features.                                                                     │
│                                                                                                                             │
│  No available IDEs detected. Make sure your IDE has the Claude Code extension or plugin installed and is running.           │
│                                                                                                                             │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
 Esc to exit

Additional Context

If I run claude /ide in an external terminal (i.e. seperate from VS Code) running in the same working directory as VS code then VS Code is detected and can be connected to

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                      │
│  Select IDE                                                                                                          │
│  Connect to an IDE for integrated development features.                                                              │
│                                                                                                                      │
│     1. Visual Studio Code                                                                                            │
│   ❯ 2. None✔                                                                                                         │
│                                                                                                                      │
│  ※ Tip: You can enable auto-connect to IDE in /config or with the --ide flag                                         │
│                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

thegrahamking avatar Aug 05 '25 12:08 thegrahamking

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4662
  2. https://github.com/anthropics/claude-code/issues/3492
  3. https://github.com/anthropics/claude-code/issues/5084

If your issue is a duplicate, please close it and 👍 the existing issue instead.

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 05 '25 12:08 github-actions[bot]

same issue

LckOrLck avatar Aug 06 '25 02:08 LckOrLck

it's a bug for window, i think,

LckOrLck avatar Aug 06 '25 02:08 LckOrLck

@wim-anthropic

LckOrLck avatar Aug 06 '25 02:08 LckOrLck

@np-anthropic

LckOrLck avatar Aug 06 '25 02:08 LckOrLck

@ah-anthropic

LckOrLck avatar Aug 06 '25 02:08 LckOrLck

@cal-anthropic

LckOrLck avatar Aug 06 '25 02:08 LckOrLck

Found 3 possible duplicate issues:

1. [[BUG] Unable to connect to VS code IDE (windows npm native) #4662](https://github.com/anthropics/claude-code/issues/4662)

2. [[BUG] Can't detect VSCode Extension on Windows Native Environment #3492](https://github.com/anthropics/claude-code/issues/3492)

3. [VSCode Integration Fails on Native Windows Environment #5084](https://github.com/anthropics/claude-code/issues/5084)

If your issue is a duplicate, please close it and 👍 the existing issue instead.

🤖 Generated with Claude Code

I do not believe this is an exact duplicate given that it is working in a seperate terminal, but not in the integrated on.

it's a bug for window, i think,

I'm inclined to agree given that I have the same issue in Rider #5154

thegrahamking avatar Aug 06 '25 08:08 thegrahamking

I have the issue as well where it works in windows terminal, but not in my terminal in vscode.

christopher-buss avatar Aug 07 '25 21:08 christopher-buss

I have the exact same issue https://github.com/anthropics/claude-code/issues/4662

teewood avatar Aug 09 '25 05:08 teewood

Running vs code as admin seems to work

Ian1971 avatar Aug 22 '25 11:08 Ian1971

I've updated to 1.0.88. Running as admin or user makes no difference for me. Both still show

╭────────────────────────────────────────────────────────────────────────────────╮
│                                                                                │
│  Select IDE                                                                    │
│  Connect to an IDE for integrated development features.                        │
│                                                                                │
│  No available IDEs detected. Make sure your IDE has the Claude Code extension  │
│   or plugin installed and is running.                                          │
│                                                                                │
╰────────────────────────────────────────────────────────────────────────────────╯

thegrahamking avatar Aug 22 '25 15:08 thegrahamking

I found a solution, just typeVSCODE_PID= VSCODE_CWD= TERM_PROGRAM= command claude in your VSCode integrated terminal (I use git-bash.exe)

Or if you want to use the alias/function, you can just do it in your bashrc / zshrc like this:

# You can type cc in the terminal
alias cc="VSCODE_PID= VSCODE_CWD= TERM_PROGRAM= command claude"
# You can type claude in the terminal
claude() {
  VSCODE_PID= VSCODE_CWD= TERM_PROGRAM= command claude "$@"
}

enjoy

Image

Molunerfinn avatar Aug 23 '25 02:08 Molunerfinn

And If you use cmd as VSCode integrated terminal, you can do this:

cmd /c "set VSCODE_PID= && set VSCODE_CWD= && set TERM_PROGRAM= && claude"

Molunerfinn avatar Aug 23 '25 02:08 Molunerfinn

@Molunerfinn You're an allstar, worked like a champ

sitefinitysteve avatar Sep 04 '25 19:09 sitefinitysteve

I want to hijack this to say not only this reproduces on my vscode environment (vscode terminal claude doesnt find vscode) but also in any jetbrains IDE the jetbrains ide terminal also does not work but the windows terminal (seperated from ide) works in both cases

but when I use it on the seperate terminal after asking a question, the ctrl alt k shortcut stop working and tries to open a new claude code instance instead of referecing the file im currently at in the chat

IdoAmar avatar Nov 26 '25 11:11 IdoAmar

thanks to @Molunerfinn Solution idea i was able to find a solution to the Jetbrains IDEs also : if you use powershell : $env:IDEA_INITIAL_DIRECTORY = "" $env:INTELLIJ_COMMAND_HISTFILE = "" $env:TERMINAL_EMULATOR = "" claude

IdoAmar avatar Nov 26 '25 11:11 IdoAmar

thanks to @Molunerfinn Solution idea i was able to find a solution to the Jetbrains IDEs also : if you use powershell : $env:IDEA_INITIAL_DIRECTORY = "" $env:INTELLIJ_COMMAND_HISTFILE = "" $env:TERMINAL_EMULATOR = "" claude

JetBrains Claude-Code[Beta] settings : $env:IDEA_INITIAL_DIRECTORY = ""; $env:INTELLIJ_COMMAND_HISTFILE = ""; $env:TERMINAL_EMULATOR = ""; claude

Image

Fartpeach1003 avatar Dec 12 '25 06:12 Fartpeach1003

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Jan 11 '26 10:01 github-actions[bot]