Skip to content

[devtools] Detect current VS Code executable on macOS#93473

Open
tomdai wants to merge 1 commit intovercel:canaryfrom
tomdai:tom-codex/05-04-_devtools_detect_vscode_code_on_macos
Open

[devtools] Detect current VS Code executable on macOS#93473
tomdai wants to merge 1 commit intovercel:canaryfrom
tomdai:tom-codex/05-04-_devtools_detect_vscode_code_on_macos

Conversation

@tomdai
Copy link
Copy Markdown

@tomdai tomdai commented May 4, 2026

What?

Adds the current macOS executable names for Visual Studio Code and Visual Studio Code Insiders to the dev overlay launch-editor detection table.

This keeps the existing Electron entries for older VS Code builds, while also detecting:

  • /Applications/Visual Studio Code.app/Contents/MacOS/Code
  • /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Code - Insiders

Why?

VS Code renamed its macOS executable from Electron to the product short name in microsoft/vscode#291948. That PR also added an Electron symlink for backwards compatibility, but ps x reports the real executable path as Code for current VS Code builds.

When Next.js only scans for .../Contents/MacOS/Electron, it can miss a running VS Code process and fall back to VISUAL / EDITOR. If that fallback is a terminal editor such as vim, the dev overlay opens Terminal instead of VS Code.

How?

  • Add the current VS Code and VS Code Insiders executable paths to COMMON_EDITORS_MACOS.
  • Keep the legacy Electron paths so older VS Code builds continue to be detected.
  • Factor macOS process-list matching into a small helper used by guessEditor().
  • Add unit coverage for current VS Code, legacy VS Code, and current VS Code Insiders process names.

Tests

  • npx pnpm@10.33.0 install --frozen-lockfile
  • npx pnpm@10.33.0 testonly packages/next/src/next-devtools/server/launch-editor.test.ts
  • npx pnpm@10.33.0 --filter=@next/font build
  • npx pnpm@10.33.0 --filter=next types
  • npx prettier@3.6.2 --check packages/next/src/next-devtools/server/launch-editor.ts packages/next/src/next-devtools/server/launch-editor.test.ts
  • git diff --check
  • npx pnpm@10.33.0 --filter=next build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant