Skip to content

Remember all UI state even when reopening window without workspace #207

Closed

Description

Currently, reopen files behaviour is slightly weird. If no folders are open, no files are reopened upon restart of VSC. If a folder is open, any files that are opened, inside the opened folder or not, are reopened upon restart of VSC.

I would like to see VSC reopen files, regardless the opened folder count. Should probably be settable in the preferences, I can imagine not everyone is interested in this behaviour.

Activity

  1. bpasero commented on Nov 19, 2015

    @bpasero
    Contributor

    Fair request.

  2. added
    feature-request
    on Nov 19, 2015
  3. PooLP commented on Nov 19, 2015

    @PooLP

    +1

  4. nchammas commented on Dec 2, 2015

    @nchammas

    Not sure about the scope of this issue, but I have a related problem. Let me know if I should report it in a separate issue.

    If I have multiple projects open in VS Code (e.g. 2 separate windows, each with a folder loaded) and I restart VS Code (e.g. due to an update), only the last project that was opened gets automatically reloaded.

    I think it should be on VS Code to completely restore the UI state after a restart. Chrome, for example, does this--it reloads both the correct number of windows, as well as the correct tabs within each window.

    I understand from the discussion in #264 that there is some issue with restoring state for standalone files that are opened (as opposed folders), but in my case it was 2 folders that were open.

    I'm running Code 0.10.3 on OS X.

  5. bpasero commented on Dec 2, 2015

    @bpasero
    Contributor

    Nicholas Chammas (@nchammas) you can enable restoring of all windows through the window.reopenFolders setting. Set it to all and you should be all set.

  6. nchammas commented on Dec 2, 2015

    @nchammas

    Oh snap. Good call--that did the job. 👍

  7. nautilusbits commented on Apr 21, 2016

    @nautilusbits

    So if no folders are open, opened files are not reopened after restart VSC? A bit dumb.

  8. bpasero commented on Apr 21, 2016

    @bpasero
    Contributor

    Yes, only if you open a folder we remember all UI state.

  9. changed the title [-]Reopen files[/-] [+]Remember all UI state even when reopening window without workspace[/+] on Jul 5, 2016
  10. 59 remaining items

  11. aaccioly commented on Jul 10, 2017

    @aaccioly

    Hi Benjamin Pasero (@bpasero). Just double checking, in the insiders preview looks like the new option is window.restoreWindows right? As I understand it, the value mentioned by BobbyBabes (last) is probably the new default (now called one) right?

    Looks like it is working fine. My only problem with the current version - and I'm not sure if it this is directly related - is that VS Code behavior feels odd when I have unsaved files and open a new folder.

    Currently VS Code displays a prompt asking if I want to save new files. If I don't do it the files are gone forever. This happens even with "files.hotExit": "onExitAndWindowClose".

    I would expect unsaved files to be "carried forward" and simply be there after I open a new folder.

    If I switch between two folders or if I close a folder and open it again everything works as expected (i.e., previous unsaved files are kept - unsaved files are "bound" to the current folder). The problem only manifests itself when no folder is currently open in the editor.

  12. aaccioly commented on Jul 10, 2017

    @aaccioly

    Another problem is that I'm not getting the expected behavior with:

    {
        "window.restoreWindows": "all",
        "files.hotExit": "onExitAndWindowClose"
    }

    Assume that I have two windows open, each pointing to a different folder. If I right click Visual Studio Code Icon and select "Close all windows".

    I would expect both windows to be restored the next time I launch vscode, instead I'm getting either an empty window or only one of the two previously open windows.

  13. bpasero commented on Jul 10, 2017

    @bpasero
    Contributor

    Anthony Accioly (@aaccioly) can you file this as separate issue, it seems unrelated.

  14. aaccioly commented on Jul 11, 2017

    @aaccioly
  15. bpasero commented on Jul 11, 2017

    @bpasero
    Contributor

    I would argue that "Close All Windows" should not restore the windows because you are actually closing all of them. In the same way if you close a single window we would never restore it.

    If you use File > Exit the windows will restore properly and that is the intent of the window.reopenWindows setting.

  16. zaichang commented on Jul 25, 2017

    @zaichang

    Benjamin Pasero (@bpasero) Just wanted to thank you for adding this feature, it was one of my biggest gripes with VS Code before since I work with multiple windows some of which has files from different locations. Hunting them down and re-opening them every time VS Code restarts was a pain!

  17. BobbyBabes commented on Jul 25, 2017

    @BobbyBabes

    ^^
    This!

  18. BobbyBabes commented on Jul 26, 2017

    @BobbyBabes

    Benjamin Pasero (@bpasero) This is more of a question than an issue.

    Situation:

    Version 1.14.2
    Commit cb82febafda0c8c199b9201ad274e25d9a76874e
    Date 2017-07-19T23:26:08.116Z
    Shell 1.6.6
    Renderer 56.0.2924.87
    Node 7.4.0
    
    "uname --all" output:
    Linux designbox 4.11.9-1-ARCH #1 SMP PREEMPT Wed Jul 5 18:23:08 CEST 2017 x86_64 GNU/Linux`
    
    Preferences: `"window.restoreWindows": "all"`
    
    One VSC window with a project folder opened. All files saved.
    One VSC window with just a bunch of files opened. Some with unsaved changes.
    Ctrl+Q to close all VSC windows and quit VSC.
    

    Reopening VSC (as per the title of this issue) works as expected. Both windows are restored with all files.
    Ctrl+Q again.

    Then double-clicking a source file in the file manager, opens one VSC window with just the double-clicked file.
    Ctrl+Q again.
    Start VSC from its icon, and one window opened with just the one file (that was double-clicked from the file manager).
    I restored the initial 2 windows with Ctrl+N, followed by Open recent.

    I had expected that starting VSC from its icon, would first open the 2 VSC windows. And that the source file (double clicked from the file manager) would be added to one of the 2 VSC windows. And that that window would be pushed to the foreground.
    Similar to what happens when there are already VSC windows opened, and you then double-click a source file from the file manager.

    So my question is : is this intentional, and should I therefore open a request for this behaviour to be added ?

  19. Curros commented on Aug 9, 2017

    @Curros

    Hi everyone, I'm trying to change from Sublime to VS Code so keep the old files is important for me , but I just install the version: 1.15.0-insider, and I'm not able to find the property "window.reopenWindows".
    I do have "window.restoreWindows": "all". And of course, is not restoring all the files previously opened.

    Benjamin Pasero (@bpasero) any suggestions? (tks in advance!)

  20. bpasero commented on Aug 11, 2017

    @bpasero
    Contributor

    BobbyBabes yeah that seems like a separate issue to me, you seem to want to restore your context if you start Code via the icon and ignore sessions where you opened code with a specific file. I think it should be reported as such.

    Today we simply restore your last session, no matter how you got there (e.g. by clicking the icon or opening a file).

    Angel Curros (@Curros) the setting is now called "window.restoreWindows": "all". If it does not work please report a new issue with steps how to reproduce.

  21. BobbyBabes commented on Aug 11, 2017

    @BobbyBabes

    Benjamin Pasero (@bpasero) Thanks for clearing that up. I'm opening a new request issue right after.

  22. aethelberht commented on Sep 15, 2017

    @aethelberht

    Benjamin Pasero (@bpasero)

    Today we simply restore your last session, no matter how you got there (e.g. by clicking the icon or opening a file).

    Are you saying the current intended behavior is to restore all open editors, both clean and dirty, regardless of whether VS Code is launched by the icon or launched by opening a file? Because it seems to me that the "window.restoreWindows": "all" setting is only applying to the former.

  23. bpasero commented on Sep 16, 2017

    @bpasero
    Contributor

    No, when you open a file into a window, then we do not restore the other editors.

  24. locked and limited conversation to collaborators on Nov 17, 2017
  25. added a commit that references this issue on Sep 6, 2026
    3af1072
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requeston-testplan

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions