Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open workspace file instead of root folder when opening a worktree #4016

Open
kmathmann opened this issue Feb 5, 2025 · 1 comment
Open
Labels
feature New feature or request triage Needs to be looked at

Comments

@kmathmann
Copy link

Current Behavior

The current workflow when opening a worktree (inside of the existing window and in a new window) is to use the openFolder way with the worktrees root folder.
If i have a .code-workspace file (see multiroot-workspaces), that was used to open my current window, the new window is still only opened from the folder without using the workspace file. vscode then shows me a hint that it found a workspace file and if i want to open it. But this reloads the window what requires unnecessary time, especially in devcontainer setups.

Expected Behavior

I expect gitlens to use the "open workspace from file" way from vscode if a .code-workspace file was used to open the current window. This saves time and improves the user experience.

The vscode api does provide the information if and which workspace file is currently opened. See workspace.workspaceFile. This way it is easy to find out if the current window is opened from a workspace file and to get the Uri of that file. If the same file exists in the worktree that is to be opened it can be opened with the vscode.openFolder command and the workspace file's Uri.

@kmathmann kmathmann added feature New feature or request triage Needs to be looked at labels Feb 5, 2025
@kmathmann
Copy link
Author

Looks like worktree.ts:1091 is the place where the check of the vscodes api workspace.workspaceFile and then usage of the worktree file's uri would be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request triage Needs to be looked at
Projects
None yet
Development

No branches or pull requests

1 participant