Skip to content

Use workspace file when opening repository in VS Code - #22962

Open
1kailas wants to merge 1 commit into
desktop:developmentfrom
1kailas:fix-test-for-invalid-chars-state
Open

1kailas wants to merge 1 commit into
desktop:developmentfrom
1kailas:fix-test-for-invalid-chars-state

Conversation

@1kailas

@1kailas 1kailas commented Oct 2, 2026 •

Copy link
Copy Markdown

Closes #7007

Description

When opening a repository in Visual Studio Code (or derivative editors such as VSCodium, Cursor, Windsurf), users often organize their project settings, multi-root configurations, and recommended extensions in a .code-workspace file located at the repository root. Currently, GitHub Desktop always launches the editor passing the root repository folder, which causes VS Code to open as a standard folder rather than opening the workspace.

This PR introduces workspace file detection during external editor launch:

  • When the selected editor is identified as VS Code or a derivative (Visual Studio Code, Visual Studio Code (Insiders), VSCodium, Cursor, Windsurf) and the target path is a directory:
    • Desktop inspects the top-level directory for non-hidden files ending in .code-workspace.
    • If exactly one .code-workspace file exists in the directory root, Desktop passes the path to that workspace file to the editor instead of the directory.
    • If zero or multiple .code-workspace files exist (or if the target is a specific file, or if the editor is not VS Code), Desktop falls back to passing the original target path unchanged.
  • Adds comprehensive unit tests in app/test/unit/launch-editor-test.ts covering single, multiple, hidden, directory-named, non-existent, file-target, and non-VS Code editor scenarios.

Screenshots

N/A (editor launch integration change, no UI styling changes)

Release notes

Notes: [Improved] Open repository in Visual Studio Code using the root .code-workspace file when present

@1kailas
1kailas requested a review from a team as a code owner October 2, 2026 17:57
@1kailas
1kailas requested review from sergiou87 and a balanced review from Copilot October 2, 2026 17:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for your pull request! Unfortunately, it doesn't meet the requirements for review:

  • No linked help wanted issue found in PR description

Please update your PR to address the above. This PR will be automatically closed in 7 days if these requirements are not met.

Full contribution requirements
  1. Include a detailed description of what this PR does
  2. Link to an issue with the help wanted label (use Fixes #123 or Closes #123)

@github-actions github-actions Bot added external Pull request originating outside of the Desktop core team needs-triage labels Oct 2, 2026
When launching Visual Studio Code or derivative editors for a repository
directory, inspect the repository root for a single .code-workspace file
and launch that workspace file if present. Fall back to opening the
directory when zero or multiple workspace files exist.

Closes desktop#7007
@1kailas
1kailas force-pushed the fix-test-for-invalid-chars-state branch from 872085f to 2668566 Compare October 2, 2026 18:12
@1kailas 1kailas changed the title Prevent stateful regex behavior in testForInvalidChars Use workspace file when opening repository in VS Code Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for updating your pull request! It now meets the minimum requirements and has been queued for triage.

@babakks babakks added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Oct 6, 2026

This branch has not been deployed

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

Labels

external Pull request originating outside of the Desktop core team ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use workspace file when opening repository in VS Code

3 participants