microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.85k stars 29.51k forks source link

Window not restored to its previous location and size #24227

Closed mattbanks closed 7 years ago

mattbanks commented 7 years ago

After updating to v1.11.0 (and 1.11.1), setting "window.newWindowDimensions": "inherit" no longer works. Every new window opens at the default position and size.

Extension Author Version
EditorConfig EditorConfig 0.6.2
material-icon-theme PKief 2.0.3
vscode-docker PeterJausovec 0.0.13
html-css-class-completion Zignd 1.0.3
html-snippets abusaidm 0.1.0
vscode-twig-pack bajdzis 1.0.0
python donjayamanne 0.6.0
vue-snippets hollowtree 0.1.1
Go lukehoban 0.6.59
atom-keybindings ms-vscode 2.0.1
color-highlight naumovs 1.3.2
Ruby rebornix 0.10.4
linter-xo samverschueren 2.1.3
wordpress-snippet tungvn 1.1.2
JavaScriptSnippets xabikos 1.4.0
Material-theme zhuangtongfa 2.4.0 ;

Steps to Reproduce:

  1. Update to v1.11.x
  2. Verify "window.newWindowDimensions": "inherit" is set in settings.json
  3. Close editor
  4. Open new editor
  5. Observe default position and size for new window
mattbanks commented 7 years ago

Here's my current settings.json for reference:

{
    "editor.fontSize": 14,
    "editor.lineHeight": 22,
    "editor.fontFamily": "Hack, monospace",
    "editor.scrollBeyondLastLine": false,
    "editor.minimap.enabled": false,
    "editor.wordWrap": "on",
    "editor.dragAndDrop": true,
    "xo.enable": true,
    "workbench.welcome.enabled": false,
    "workbench.colorTheme": "Material Theme",
    "workbench.iconTheme": "material-icon-theme",
    "window.reopenFolders": "none",
    "window.newWindowDimensions": "inherit",
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true,
        "**/node_modules": true
    }
}
bpasero commented 7 years ago

@mattbanks setting it to inherit only means having a window open and then opening a new one should inherit that dimension. Is that what you are doing?

mattbanks commented 7 years ago

@bpasero Yeah, before this update new windows would open where the previous window was and at the same size. Now they're all in the default position and the default size, so I have to resize and move every editor window I open. This used to work when I run code . in terminal for a directory, every window would open at the same size/location. Now that no longer works.

bpasero commented 7 years ago

@mattbanks to be clear, you start with one window, you move it around/size it, then you close and then you start again and it does not position where it left off?

I just tried with your settings and cannot reproduce. Proof:

untitled

mattbanks commented 7 years ago

@bpasero correct. I'm going to try to take a screencast (I don't have screenflow installed on this machine). I open a window with code ., make it larger and move it to my external monitor. If I close the windows and run code . again, I get a new window in the default centered position with smaller size on my MacBook Pro screen.

bpasero commented 7 years ago

@mattbanks I wonder if this is multi monitor related, also try with single monitor.

mattbanks commented 7 years ago

@bpasero just tried only on my MacBook Pro (external monitor was still connected, but only used laptop screen.

Here's a gif (rather large, so not embedding here): http://mattbanks.me/assets/img/random/code-window-issue.gif

bpasero commented 7 years ago

@mattbanks but you are not moving the window out of the desktop size somehow right? because on startup we try to validate the stored window dimensions and restore it only if they are valid.

And can you try again the same thing with a 1.10.x install to see if this is a regression? Grab it from https://az764295.vo.msecnd.net/stable/8076a19fdcab7e1fc1707952d652f0bb6c6db331/VSCode-darwin-stable.zip

mattbanks commented 7 years ago

@bpasero Nope not dragging out out desktop size. It was out of that gif/video window, but resized to fit before closing.

I'll grab v1.10.x now and try it.

mattbanks commented 7 years ago

@bpasero confirmed it works if I downgrade to v1.10.x from the link you sent. After upgrading back to 1.11.1 (direct download from https://code.visualstudio.com/), I'm seeing the incorrect behavior again.

bpasero commented 7 years ago

@mattbanks ok back to 1.11.1, what happens when you run "code --user-data-dir <some empty folder>" to bypass any settings and cached data?

mattbanks commented 7 years ago

@bpasero It opens in the default position/size every time when passing the --user-data-dir flag. I tried with an two different empty dirs and also opened again with those dirs after resizing.

bpasero commented 7 years ago

@mattbanks ok I am running out of ideas. If you are willing to run VS Code from its sources (setup here: https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run-from-source) I could give you some pointers where to add logging.

mattbanks commented 7 years ago

@bpasero sure I can definitely do that! I'll have to wait until Monday to get that setup - need to finish up a project today :)

bpasero commented 7 years ago

@mattbanks awesome! let me know when you are ready

obedm503 commented 7 years ago

I'm having the same problem on xubuntu 16.04. But it also happens when setting "window.newWindowDimensions": "maximized".

kzhui125 commented 7 years ago
  1. set "window.newWindowDimensions": "maximized" or "fullscreen"
  2. Did not take effect for the first time opening vscode.
  3. with the setting "maximized", when double click the top blank area to restore the window dimension, I want the new dimension is "inherit", not a very small window, I have to resize the window every time.
mattbanks commented 7 years ago

Switching to "maximized" works for me, it's just "inherit" that doesn't work. @bpasero sadly I still haven't had a chance to take a look at debugging this, as some projects are still ongoing for me. I'll take a look as soon as I can!

bpasero commented 7 years ago

window.newWindowDimensions is only for opening new windows, not for the initial one (hence the name). the initial one always restores its dimensions from the previous session.

kzhui125 commented 7 years ago

@bpasero , when double click the top blank area on new maximized windows, can we make its dimension the same with previous session?..

bpasero commented 7 years ago

That sounds like a separate feature request unrelated to the window.newWindowDimensions setting.

lilyball commented 7 years ago

I'm having this same issue. window.newWindowDimensions: "inherit" works just fine if I have an existing window and I open a new window. But if I close all windows, and then open a new one, it behaves like "default". This is very annoying.

macOS 10.12.4 (16E195), VS Code 1.11.2

bpasero commented 7 years ago

https://github.com/Microsoft/vscode/issues/26296

bpasero commented 7 years ago

Reopening as after reading the comments again I think the real issue is not related to the window.newWindowDimensions setting but rather that we fail to restore the location of the previously closed window.

@mattbanks @obedm503 @King66 @kballard @GoodGuyNick to ensure we are all talking about the same thing can you do an experiment such as:

=> does the window restore to where you put it or not? => any difference when using multiple monitors (if you are using multiple at all)?

Here is how it works for me:

panel-red

kzhui125 commented 7 years ago

@bpasero does the window restore to where you put it? => yes, same with you(one monitor, 1920x1080)

By the way, I'm using the inherit setting now. With the inherit setting, it works fine almost always(window will restore size). I just met once the window open with a size about 1010x761(default size, too small, not the size I use). I can't reproduce now..

bpasero commented 7 years ago

@King66 can you explain where your remaining issue still is please? So it is unrelated to the first window restoring you say?

bpasero commented 7 years ago

@mattbanks @obedm503 @King66 @kballard @GoodGuyNick are you guys actually do what is described in https://github.com/Microsoft/vscode/issues/26353#issuecomment-300408442 ? I can reproduce that 👍

kzhui125 commented 7 years ago

@bpasero because the "maximized" setting I used in the past has problem as I described, so I use "inherit" setting now... "inherit" works fine almost always in my case(Win10 1.12.1)

GoodGuyNick commented 7 years ago

@bpasero

=> does the window restore to where you put it or not?

yes but if I then maximize window and reopen it will revert to the default size and position.

are you guys actually do what is described in #26353 (comment) ? I can reproduce that

no. I make clean install of vscode then open it, the window will be in the default size and position(not maximized and centered). Then I maximize window and reopen vscode expecting window to remember last state but it will again opens in default size and position

If i use "window.newWindowDimensions": "maximized" or "inherit" and open second window it is still opens in the default size and position

bpasero commented 7 years ago

@King66 let me try to rephrase what you see working and what not:

Is that what you see is going wrong? I am having a hard time to understand your issue. Maybe a screen recording would help.

@GoodGuyNick

yes but if I then maximize window and reopen it will revert to the default size and position.

I tried to reproduce what you are saying but I cannot. Are you on some Windows insiders build maybe? flicker_chrome58

If i use "window.newWindowDimensions": "maximized" or "inherit" and open second window it is still opens in the default size and position

I can also not reproduce that:

flicker_chrome58

GoodGuyNick commented 7 years ago

@bpasero Xubuntu 16.04.2 In the past Atom had the same issue with the linux

bpasero commented 7 years ago

I see, not reproducible on my Ubuntu 15 at least.

mattbanks commented 7 years ago

@bpasero still can't reproduce the behavior you posted in this gif...

image

With no external monitor and using all steps you posted above in https://github.com/Microsoft/vscode/issues/24227#issuecomment-300385069, it still opens in the default size and default position for me. I have 2 MacBook Pro's here and it's happening on both.

macOS Sierra 10.12.4 Visual Studio Code Version 1.12.1 (1.12.1)

kzhui125 commented 7 years ago

@bpasero you're right... For me, the initial window restore the way I left it. And I think "inherit" setting works fine so I am using it.. https://drive.google.com/file/d/0B9sSiOdezYhvaDFpeDZPTVJjaWM/view

GoodGuyNick commented 7 years ago

@bpasero don't use outdated linux distributions for testing. Use latest LTS releases for any kind of Ubuntu. I've tested on Ubuntu 16.04.2 and Ubuntu GNOME 16.04.2 and there are no issues. I will test on Ubuntu MATE, KDE neon, Linux Mint.

bpasero commented 7 years ago

@mattbanks I am trying to decode what your gif is showing:

@GoodGuyNick thanks, yes my Linux is old I should probably update.

mattbanks commented 7 years ago

@bpasero Sorry for the confusion - I pasted your gif from above to show the behavior that I'm still not seeing.

Here's what I'm still seeing: http://mattbanks.me/assets/img/random/code-window-issue.gif

expected behavior: window retains last used settings when the app is closed, so that new instances of the app window open in the last used size and position.

caveat: it works as expected if I set "window.newWindowDimensions": "maximized". However, I prefer not having it maximized every time, and inherit would be the ideal setting.

It sounds like this needs to be a new setting, since window.newWindowDimensions is not intended to work on new instances of the app window (although it did previously work in the past).

bpasero commented 7 years ago

@mattbanks can we for this exercise not define the window.newWindowDimensions setting at all, it should not have an impact on what you are seeing. This setting is only used for any window that opens after the initial window is opened and it seems what you are seeing is that the initial window is not retaining its position?

Can you try to reproduce this from our current insiders build, I pushed a fix in this area that might have an impact: You can give our preview releases a try from: http://code.visualstudio.com/Download#insiders

mattbanks commented 7 years ago

@bpasero Correct - the issue I'm seeing is that the initial window is only opening in the default positon and not retaining any previously used position or size settings.

Downloading the Insiders build now - will report back shortly!

mattbanks commented 7 years ago

@bpasero confirmed the Insiders build works as expected! 👍 😄

I tested it with multiple monitors or just on my laptop with no external display connected, resized the window a few times and closed and re-opened the app. The initial window position was properly retained.

bpasero commented 7 years ago

@mattbanks great to hear that, but I am still a bit puzzled. My fix (for https://github.com/Microsoft/vscode/issues/26353) was fixing an issue where the position and size of the window was not restored if you close the window (click the x in the title) and then quit the app and then restart. I assume you are pressing Cmd+Q to quit, is that true?

mattbanks commented 7 years ago

@bpasero Yup, I Cmd+Q to quit the app. I typically Cmd-W all open windows before quitting, if that makes a difference in debugging it.

lilyball commented 7 years ago

I just tested the insiders build and I'm seeing really weird behavior. For context, I've removed the window.newWindowDimensions setting entirely. Here's what I'm seeing:

  1. I launch the app and open a new window, it starts out small and centered.
  2. I move and resize it.
  3. I close it.
  4. I open a new window. Small and centered again.
  5. I move and resize it.
  6. I close it.
  7. I quit.
  8. I relaunch. New window is small and centered again.
  9. I move and resize this one.
  10. I quit without closing the window.
  11. I relaunch. It restores the window back to the previous position.
  12. I move and resize it.
  13. I close it.
  14. Now here's the weird part. I open a new window. It opens in the same position and size as the initial restored window (but not in the position that I had moved that window to before closing it).

So basically, the behavior I'm seeing is: If I have no windows open and I open a new one, it always opens in the size and position that the initial window did when I launched the app. And the initial window always opens small and centered, unless I had quit the app with a window already open, at which point it instead restores that window size/position.

This is on macOS 10.12.4 (16E195).

GoodGuyNick commented 7 years ago

@bpasero I've tested on a latest LTS releases of Ubuntu MATE, KDE neon, Linux Mint Cinnamon and there are no issues. But on a Linux Mint Xfce was the same problem. I've not tested other DE or WM so for now problem only occurs when using vscode with Xfce.

bpasero commented 7 years ago

@mattbanks that explains why my fix helps you, thanks.

@GoodGuyNick thanks for testing 👍

@kballard I tried your steps and could not see something odd but that could also be me not following your steps precisely enough. Can you repeat the steps, but this time be very clear what you are doing: e.g. when you quit, do you close a window first and then quit? Here is an example of how detailed I would need your reproduction steps to be:

GoodGuyNick commented 7 years ago

@bpasero I've tested on LXDE, LXQt and there are no issues.

kzhui125 commented 7 years ago

@bpasero Just found another problem when using "inherit" setting. After minimize a VSCode window, opening another VSCode window will use the default size, I think this is not reasonable..

2

lilyball commented 7 years ago

@bpasero Ok, I reproduced it again. Once again, I left "window.newWindowDimensions" undefined.

As near as I can tell, VSCode's behavior is: upon quit, if there are any windows open, pick one and record its size/position. Then on the next launch, it reads this size/position, and any time VSCode opens a window that session when there are no existing windows it uses that saved size/position. If I quit VSCode without having any windows open, it doesn't save a size/position, and therefore new windows in the next session use the "default" size/position.

This is, frankly, pretty weird.

bpasero commented 7 years ago

@kballard is that with stable or with the insiders build?

@King66 good catch, I have extracted https://github.com/Microsoft/vscode/issues/26586

lilyball commented 7 years ago

@bpasero That was with the Insiders build.