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 folder not reused window with multi root workspace #215749

Open
Thaina opened this issue Jun 16, 2024 · 2 comments
Open

Open folder not reused window with multi root workspace #215749

Thaina opened this issue Jun 16, 2024 · 2 comments
Labels
feature-request Request for new features or functionality workbench-window Window management

Comments

@Thaina
Copy link

Thaina commented Jun 16, 2024

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.90.1, maybe since we have multi-root workspace system
  • OS Version: Windows 10

Steps to Reproduce:

  1. Open some folder in vscode
  2. Add some more folders into workspace and it would become workspace
  3. Open folder that already opened in workspace with cli code <opened folder>

Result behaviour is, it will just open a new window with a folder that already opened in another window workspace

With -r option it then trying to close the last active window and reopen into only that folder
With -a it then try to create workspace if that folder is not yet opened
Drop the folder and only open the file with -g then it might open a last active window that not a window that actually contain the file
All of these are not ideal

I wish that if there is any workspace already contain that folder it should just make that window become active and use it. But if there is none then it should open new window normally. This should be default behaviour of vscode without any flag

If it can't be default behaviour then I would like to propose a new flag, such as --reused-if-exist/-re

Also sometimes we would like to open folder to existing workspace, but specifically to workspace that already contain folder we known. And so I would like to also propose that there could be a flag --add-to <mainfolder> which will check that, if the mainfolder already opened in any window, it would use that window to create workspace

Or maybe let it that, when we open code with list of folder into workspace, if the first folder in the list already opened, vscode will use that folder as the main, choose opened window as a base, and open workspace in that window

Is this behaviour possible?

@Thaina
Copy link
Author

Thaina commented Jun 16, 2024

It seem like this might be the problem

export function findWindowOnWorkspaceOrFolder(windows: ICodeWindow[], folderOrWorkspaceConfigUri: URI): ICodeWindow | undefined {
for (const window of windows) {
// check for workspace config path
if (isWorkspaceIdentifier(window.openedWorkspace) && extUriBiasedIgnorePathCase.isEqual(window.openedWorkspace.configPath, folderOrWorkspaceConfigUri)) {
return window;
}

The code here was tested only if the workspace itself has the same root as the folder it try to opened but not ask for the opened folder inside workspace unlike findWindowOnFile above

@bpasero bpasero added feature-request Request for new features or functionality workbench-window Window management labels Jun 16, 2024
@bpasero bpasero removed their assignment Jun 16, 2024
@VSCodeTriageBot VSCodeTriageBot added this to the Backlog Candidates milestone Jun 16, 2024
@VSCodeTriageBot
Copy link
Collaborator

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality workbench-window Window management
Projects
None yet
Development

No branches or pull requests

3 participants