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

With window.restoreWindows=preserve files do not pick a good window to open #111605

Closed
joaomoreno opened this issue Dec 1, 2020 · 5 comments
Closed
Assignees
Labels
*out-of-scope Posted issue is not in scope of VS Code workbench-window Window management
Milestone

Comments

@joaomoreno
Copy link
Member

Testing #111420

use the terminal to open VSCode on a file when VSCode is not running and verify all your other windows from before also open and the file opens in either your last active window or the one that has the parent folder opened

This didn't work for me.

On Windows, with WSL. I had two windows open: vscode (WSL) and fakeproject (not WSL). Without Code running, I invoked code-insiders C:\Users\joao\Desktop. Now I have three windows: vscode (WSL), fakeproject and Desktop. I exit Code. I then invoked code-insiders C:\Users\joao\Desktop\file.txt. The same three windows come up but file.txt is open in the fakeproject window instead of the Desktop window. 🐛

@bpasero bpasero added the workbench-window Window management label Dec 1, 2020
@bpasero bpasero added this to the November 2020 milestone Dec 1, 2020
@bpasero bpasero added the bug Issue identified by VS Code Team member as probable bug label Dec 2, 2020
@bpasero bpasero removed this from the November 2020 milestone Dec 2, 2020
@bpasero bpasero changed the title File opens in wrong window, when using window.restoreWindows=preserve With window.restoreWindows=preserve files do not pick a good window to open Dec 2, 2020
@bpasero
Copy link
Member

bpasero commented Dec 2, 2020

Collection of Issues

When you pass a code-workspace file on the command line but have a folder restored, we wrongly focus the folder and not the workspace because our window open logic does not take the order into account here, we simply go in categories of folders, then workspaces to open as windows. You will also notice that the workspace wrongly opens in the restored window and the folder in the new window.

When instructing VSCode to open files (e.g. from command line), and it is not running, we simply have no logic that ensures the files open in the "right" windows (e.g. those that have the parent folders opened). We do this only when VSCode is already running and you pass files in (via findWindowOnFile).

When none of the windows would match, we still simply open the files in the first window, where we should probably pick the window that was last active (#111620).

Conclusion

The best way forward is probably to rewrite the code that opens or restores windows on startup with these goals in mind. The fact that the order of windows to open is totally mixed up when we actually open windows does not help.

@joaomoreno
Copy link
Member Author

joaomoreno commented Dec 2, 2020

I doubt you'll get this specific issue out in the wild. So let's just close it silently. 🤫

@joaomoreno joaomoreno removed bug Issue identified by VS Code Team member as probable bug workbench-window Window management labels Dec 2, 2020
@bpasero bpasero reopened this Dec 2, 2020
@bpasero
Copy link
Member

bpasero commented Dec 2, 2020

Oh I actually think I would like to fix this and I do think it is quite annoying, especially for users that have asked for the feature to restore windows, so I will see what I can do.

@bpasero
Copy link
Member

bpasero commented Dec 2, 2020

Ah, the "I am too afraid to change the existing code. " was misleading, I just didn't want to push a fix now in endgame week. Needs some good testing in insiders.

@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug workbench-window Window management labels Dec 2, 2020
@bpasero bpasero added this to the Backlog milestone Feb 10, 2021
@bpasero
Copy link
Member

bpasero commented Apr 29, 2021

i have actually never gotten an issue for this, so I will close it. not so straight forward as I had hoped...

@bpasero bpasero closed this as completed Apr 29, 2021
@bpasero bpasero added *out-of-scope Posted issue is not in scope of VS Code and removed bug Issue identified by VS Code Team member as probable bug labels Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*out-of-scope Posted issue is not in scope of VS Code workbench-window Window management
Projects
None yet
Development

No branches or pull requests

2 participants