Skip to content

[FEATURE] Improve VS Code runtime detection: use .vscode/ directory presence as fallback #358

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

Is your feature request related to a problem? Please describe.

The current VS Code runtime detection relies exclusively on shutil.which("code") — i.e., whether the code CLI command is on the system PATH. On macOS, many users have VS Code installed but have never run "Shell Command: Install 'code' command in PATH" from the command palette. This means APM silently skips VS Code configuration even when the user is clearly working inside VS Code (evidenced by a .vscode/ directory in the project).

This leads to inconsistent behavior across machines with the same OS and the same APM build:

  • Machine A (has code on PATH): configures for Copilot, Codex, and VS Code.
  • Machine B (no code on PATH, but has .vscode/ in the project): configures for Copilot only, missing VS Code entirely.

The relevant detection logic is in src/apm_cli/integration/mcp_integrator.py (lines ~833–853):

if runtime_name == "vscode":
    if shutil.which("code") is not None:
        ClientFactory.create_client(runtime_name)
        installed_runtimes.append(runtime_name)

Describe the solution you'd like

APM should use a .vscode/ directory presence check as a fallback when shutil.which("code") returns None, similar to how Cursor and OpenCode detection already work:

if runtime_name == "vscode":
    if shutil.which("code") is not None or (Path.cwd() / ".vscode").is_dir():
        ClientFactory.create_client(runtime_name)
        installed_runtimes.append(runtime_name)

This makes the detection consistent with the existing pattern for Cursor (.cursor/) and OpenCode (.opencode/), and correctly recognizes that the user is working in a VS Code context.

Describe alternatives you've considered

  1. Check for VS Code application bundle on macOS — e.g., look for /Applications/Visual Studio Code.app. This is more fragile (non-standard install paths, Insiders edition, etc.) and platform-specific.
  2. Check for $VSCODE_* environment variables — VS Code sets variables like VSCODE_PID when running in its integrated terminal. However, this doesn't help when APM is run from a standalone terminal.
  3. Do nothing and document it — Require users to install the code CLI command. This hurts developer experience since the current behavior is confusing and silent.

Additional context

  • The Cursor and OpenCode runtimes already use directory-presence detection (.cursor/, .opencode/), so extending this pattern to VS Code (.vscode/) is consistent with the existing architecture.
  • On a fresh macOS install, VS Code does not add code to PATH by default — the user must explicitly do so. This is a common source of confusion.
  • The apm install output gives no indication that VS Code was skipped due to PATH issues, making it hard for users to diagnose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageNew issue, not yet reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions