vscode: problematic window size and position

If a window is already active and maximized, opening an existing file will "restore" the window size and position.

The expected behavior would be to maintain whatever window state was in use.

There's a similar issue on GitHub: "Preserve window size when restoring a maximized window" (https://github.com/Microsoft/vscode/issues/422) with mentions to this specific problem found in the discussion.

There was also "New windows should get the size of the previous active window" (https://github.com/Microsoft/vscode/issues/10864) which was addressed by means of a new setting...

bpasero 2017-01-17

A new setting window.newWindowDimensions allows to control how new windows should open. By default, a new window will open in the center of the screen with small dimensions. If you change this setting to inherit, the new window will get the same dimensions as the last active one. Setting it to maximized or fullscreen will always open new windows either maximized or in fullscreen.

But the default value of this setting is not to preserve previous window state.

So I reported a new issue (https://github.com/Microsoft/vscode/issues/48223).

And then I found "Add a setting to define how the initial first window should size" (https://github.com/Microsoft/vscode/issues/26296).

Lastly, I found that setting window.newWindowDimensions to inherit does not prevent the window status from being reset on opening existing files, if the editor currently has a folder opened. Also reported (https://github.com/Microsoft/vscode/issues/48249).


In conclusion, the situation is a bit of a mess:

  • a new setting had to be created when this could be avoided if only the program would behave "normally" (like gedit, firefox, libreoffice...) and simply did not change window state if it was modified by the user.

  • window.newWindowDimensions - "The naming is a bit unfortunate because (...)".

  • the new setting doesn't use a sensible default value.

  • even when set to inherit it does not have an effect if the editor has a "folder" opened.

  • there's a closely related issue where, if the user (i) sets a custom window size and position; (ii) maximizes the editor; and (iii) closes the editor, when it's reopened and the user wishes to restore the window, it'll restore to its default configuration instead of the previously defined by the user.

Edited Apr 20, 2018 by Marc Ranolfi
Assignee Loading
Time tracking Loading