Skip to content

Use workspace file when opening repository in VS Code #7007

Open

Description

Problem
When I open a repo in Github Desktop the app suggests to open the repo in Visual Studio Code. That's great, but instead of opening the root folder I would like it to open .code (workspace) file when it is available in the root. Either per default or via a setting.

Thanks for a great product!

Activity

  1. added
    infrastructure
    on Mar 4, 2019
  2. shiftkey commented on Mar 4, 2019

    @shiftkey
    Member

    @SimonKibsgaard thanks for the feedback!

    Do you have any links to resources explaining this file in more detail?

  3. added
    more-info-needed
    integrations
    and removed
    infrastructure
    on Mar 4, 2019
  4. ghost closed this as completedon Mar 4, 2019
  5. ghost reopened this on Mar 4, 2019
  6. added
    help wanted
    and removed
    more-info-needed
    on Mar 4, 2019
  7. shiftkey commented on Mar 4, 2019

    @shiftkey
    Member

    @SimonKibsgaard thanks for the extra information!

    For the moment I'm going to mark this as help wanted as this is a great chance for someone who knows VSCode and workspaces to look into trying to add support for this.

    The current launch function for opening an editor isn't aware of editor-specific rules, so I suspect that area will need some enhancement:

    /**
    * Open a given file or folder in the desired external editor.
    *
    * @param fullPath A folder or file path to pass as an argument when launching the editor.
    * @param editor The external editor to launch.
    */
    export async function launchExternalEditor(
    fullPath: string,
    editor: FoundEditor
    ): Promise<void> {

  8. roottool commented on Apr 28, 2019

    @roottool
    Contributor

    I think that this issue needs to be considered about a pattern that .code-workspace file exists more than one in the root.

    I have an one question.
    Does Github Desktop the app open all .code-workspace file?

  9. shiftkey commented on Apr 29, 2019

    @shiftkey
    Member

    Does Github Desktop the app open all .code-workspace file?

    Not currently

  10. samundra commented on Dec 15, 2019

    @samundra
    Contributor

    Hi @shiftkey

    I was exploring code for this feature and able to get this working if we use file with code-workspace in fullPath

    export async function launchExternalEditor(
      fullPath: string,
      editor: FoundEditor
    ): Promise<void> {
      ...
      ...
      if (editor.editor === 'Visual Studio Code') {
        readdir(fullPath, (err, files) => {
          if (err) {
            return console.log('Unable to scan directory: ' + err)
          }
          files.forEach(f => {
            if (f.endsWith('code-workspace')) {
              fullPath = Path.join(fullPath, f)
            }
          })
        })
      }
    

    Current problem, I have is fullPath doesn't seem to change after readdir has finished doing it's job. How can I get that fullPath outside of callback so that it can be used in

    if (editor.usesShell) {
        spawn(`"${editorPath}"`, [`"${fullPath}"`], { shell: true })
      } else {
        spawn(editorPath, [fullPath])
      }
    
  11. Soitora commented on Feb 17, 2020

    @Soitora

    How's this come along?

  12. removed their assignment
    on Sep 3, 2021
  13. Lol702702 commented on Jun 5, 2022

    @Lol702702

    Problem When I open a repo in Github Desktop the app suggests to open the repo in Visual Studio Code. That's great, but instead of opening the root folder I would like it to open .code (workspace) file when it is available in the root. Either per default or via a setting.

    Thanks for a great product!

  14. silopolis commented on Mar 31, 2023

    @silopolis

    For those desperately hoping for this to be implemented, I found myself an alternative solution, using the wottpal/vscode-auto-open-workspace extension.
    It actually starts by launching VSCode and immediately reloads the workspace, but that does the trick :)
    See settings for other possible behaviors.

    PS: There is also haifengkao/AlwaysOpenWorkspace which I haven't tested…

  15. liangchen0202 commented on Sep 26, 2026

    @liangchen0202

    Hi, I'm interested in working on this issue. I checked the current launchExternalEditor implementation on the development branch, and it still passes the provided repository path directly to the selected editor.
    My plan would be to add VS Code-specific .code-workspace detection along with tests, while continuing to open the repository folder when no workspace file is present.

  16. added a commit that references this issue on Oct 2, 2026
    2668566
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedintegrations

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions