vscode: Codespaces: better handle invalid workspaces when opening
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: Insiders
- OS Version: Mac OS
Repro Steps:
- Create a codespace
- Open a subdirectory using
File -> Open...
, which will cause future connections to connect to that folder by default - Delete/rename the subdirectory so that it doesn’t exist anymore
- Disconnect and try to reconnect to the codespace
Expected: The connection succeeds, ideally to the repo root as the fallback, or instead by recreating the missing folder and connecting to the empty folder.
Actual: Connection fails
Issue reported to codespaces: https://github.com/microsoft/vssaas-planning/issues/5354
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (18 by maintainers)
Commits related to this issue
- Codespaces: better handle invalid workspaces when opening (#133872) — committed to microsoft/vscode by bpasero 3 years ago
@jkeech @GideonCheruiyot can I get some UI thoughts on this flow:
Desktop
Web
Both folder and workspace file (
*.code-workspace
) are validated right on startup. The user can still cancel though, but I think that is fair.//cc @misolori
Just to clarify: the feature where Codespaces remembers the last folder is not the only way this can happen. We’ve seen reports from users where they’ve deleted/renamed the repo directory as well, so always opening that one can have a similar problem. The product team does not want to change the behavior of Codespaces remembering the last folder/workspace you used either, since most people want to pick up right where they left off.
I really like this idea. Could you open the folder picker from
File: Open..
with a message to the user saying that the requested folder/workspace doesn’t exist and ask them to pick from one of the places that does exist? It seems like this solution would work for both web and desktop as well.If we did this, we can always start the VS Code server and complete the connection from the resolver side, and then internally VS Code can guide the user down the path of picking a good folder if the requested one is invalid. Once the user picks, the window would likely reload into that folder.
Looks like I missed a fix to recreate a deleted workspace folder which is why I couldn’t repro by deleting the workspace folder. Verified the fix in both Web and Desktop by trying to delete and connect to non-workspace folders. Thanks! @bpasero.
It shipped to insiders, I just verified it on web and it seems to work. It should work equally well on desktop.
@bpasero I take back this and I do not think following call can return the status
https://github.com/microsoft/vscode/blob/31152fd902cf50ea37c2667ed4c6d57000c771d0/src/vs/workbench/electron-sandbox/shared.desktop.main.ts#L318
because,
initialize
will not wait always for the workspace folders to be resolved especially when these folders are remote. Otherwise this will cause deadlock.If you would like to validate, I would recommend to resolve the workspace folders outside and take appropriate action.