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

Opening a file through the command line drops windows with no unsaved files #53798

Closed
tomzx opened this issue Jul 8, 2018 · 3 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@tomzx
Copy link
Contributor

tomzx commented Jul 8, 2018

  • VSCode Version: 1.25.0.
  • OS Version: Windows

Steps to Reproduce:

  1. Run code from the command line
  2. Open a few windows with different workspaces and no edited files
  3. Have the "window.restoreWindows": "all" setting so that on restart, all windows should open
  4. Exit code
  5. Run code from the command line again
  6. Observe that all the previous windows are opened
  7. Exit code
  8. Run code but pass a file as argument
  9. Observe that code only opened a window for this file and that all previous windows are not restored. Also observe that exiting code and running it again with no argument results in the previous windows not being restored.

Might be related to #36964.

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

@vscodebot vscodebot bot added the new release label Jul 8, 2018
@tomzx tomzx changed the title Opening a file through command line drops windows with no unsaved files Opening a file through the command line drops windows with no unsaved files Jul 8, 2018
@phuze
Copy link

phuze commented Jul 8, 2018

Yes, this is a bug -- unfortunately, I don't think Microsoft feels that way.

#15949 (comment)

When you instruct Code to explicitly open on a resource (file or folder), we do not restore the windows.

See other issues:

#15949
#50846

@tomzx
Copy link
Contributor Author

tomzx commented Jul 8, 2018

@purplekrayons Thanks for pointing out this has already been reported.

I guess the best we could do is suggest approaches that would make it possible for us to be happy without breaking existing behavior, such as adding a new command line option --restore-session, or maybe discuss about the idea of windows sessions?

Windows sessions would be a set of windows you can save the state into a file and have restored, very similar to workspaces, but at the windows level. With sessions, running code . would open a new unsaved session with only the folder you opened, even if you have another session with multiple windows and modified files in them. By default I would expect code . to use the "default session", which would be the last state when code was closed (and the state which would be restored if you run code without argument). You could pass something like code . --new-session to start a new session with only the specified path being opened, which could be useful for quick editing.

Obviously the best would be to have full control over how sessions get restored. You should be able to configure it so that by default it either restores everything, or nothing. You should also be able to override this when launching the command line, so that opening a path from explorer/finder/cmd/terminal would either only open this single path or open this path and restore all your previous windows.

I can tell my idea of windows sessions is definitely not polished, but it might be a starting point for further discussion on how to solve this so that both the existing behavior and our desired behavior can be achieved.

@bpasero bpasero added the *duplicate Issue identified as a duplicate of another issue(s) label Jul 9, 2018
@vscodebot
Copy link

vscodebot bot commented Jul 9, 2018

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Jul 9, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

3 participants