You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use workspace file when opening repository in VS Code #7007
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!
Reacted by Jay Trees, Ali Mert Çakar, aunzaazab, Gerhard Zelenka, Michał Droździk, BobSaidHi, Simon Depelchin and Agriya Khetarpal
Reacted by aunzaazab
Reacted by Jérémie Tarot, Marius Nergård and Agriya Khetarpal
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:
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
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.
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.
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.
Activity
shiftkey commentedon Mar 4, 2019
@SimonKibsgaard thanks for the feedback!
Do you have any links to resources explaining this file in more detail?
shiftkey commentedon Mar 4, 2019
@SimonKibsgaard thanks for the extra information!
For the moment I'm going to mark this as
help wantedas this is a great chance for someone who knows VSCode and workspaces to look into trying to add support for this.The current
launchfunction for opening an editor isn't aware of editor-specific rules, so I suspect that area will need some enhancement:desktop/app/src/lib/editors/launch.ts
Lines 5 to 14 in e4a7e23
roottool commentedon Apr 28, 2019
I think that this issue needs to be considered about a pattern that
.code-workspacefile exists more than one in the root.I have an one question.
Does Github Desktop the app open all
.code-workspacefile?shiftkey commentedon Apr 29, 2019
Not currently
samundra commentedon Dec 15, 2019
Hi @shiftkey
I was exploring code for this feature and able to get this working if we use file with
code-workspaceinfullPathCurrent problem, I have is
fullPathdoesn'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 inSoitora commentedon Feb 17, 2020
How's this come along?
curtcurt871 commentedon Mar 31, 2021
https://github.com/desktop/desktop/projects/8#card-18583843
Lol702702 commentedon Jun 5, 2022
silopolis commentedon Mar 31, 2023
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…
liangchen0202 commentedon Sep 26, 2026
Hi, I'm interested in working on this issue. I checked the current
launchExternalEditorimplementation 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-workspacedetection along with tests, while continuing to open the repository folder when no workspace file is present.Open the repo's VS Code workspace file when there is one
Use workspace file when opening repository in VS Code
Open the repo's VS Code workspace file when there is one
Open the repo's VS Code workspace file when there is one