Skip to content

[macOS] Properly handle Window Restoration during Sudden Termination (for Spaces) #16991

Closed

Description

  • VSCode Version: Code 1.7.2 (7ba55c5, 2016-11-21T22:01:10.756Z)
  • OS Version: Darwin x64 16.1.0
  • Extensions:
Extension Author Version
python donjayamanne 0.5.5
debugger-for-chrome msjsdiag 2.3.2

Steps to Reproduce:

  1. Create multiple Spaces for the current User.
  2. Open Visual Studio Code on macOS (any version 10.7+).
  3. Open a Folder (or new window) multiple times: once, at least, in each Space you created in Step 1.
    • Ensure you have the window.reopenFolders setting set to all.
  4. Perform one of the following Sudden Termination actions:
    1. Logout of the current User. Log back into the same user.
    2. Shut Down the computer. Turn the computer back on.
    3. Restart the computer.

Expected Results:

Visual Studio Code's windows restore to the Spaces they were in when the action in Step 4 took place.

Actual Results:

Visual Studio Code restores all windows to the current Space (typically "Desktop 1") when the user is properly logged back in. They must be manually reassigned to the previous spaces.

Errata:

  • Compare Visual Studio Code's results with that of Apple's built-in applications: all windows of Apple-built apps correctly restore to the Space they existed in prior to the Sudden Termination event.
  • Apple does offer the ability to Assign apps to Spaces. However, this only adjusts what Space the Windows start in. If a user intentionally moves the windows to different Spaces then all Windows would recollect to that space upon restart instead of the previously assigned Space (as expected). In short, this is not a solution to the problem.
  • Use Case: A developer creates three Spaces and opens a folder in a unique Visual Studio Code window on each Space. These Spaces serve different development contexts for the developer. When restarting (say from OS update), the developer expects the windows to restore to the previously used Space.
  • According to Apple Developer Relations, apps that wish to support this feature must "use NSWindow’s encodeRestorableStateWithCoder: and restoreStateWithCoder:" (those APIs are part of NSResponder). This is also somewhat outlined here.

Activity

  1. bpasero commented on Dec 12, 2016

    @bpasero
    Contributor

    Duplicate of #979 (but I copied your nice description over).

  2. added
    *duplicate
    on Dec 12, 2016
  3. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*duplicate

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions