-
Notifications
You must be signed in to change notification settings - Fork 28.7k
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
Add a setting or always restore the last editor state for editors opening in new groups #102485
Comments
@jrieken if a group is closed, view state is not restored the next time the group is opened again because it may be frustrating for users to constantly get old view state back in that case. Imagine you had an editor split for a while and then forgot about it after closing. You then split the editor again and would probably expect the split editor to show you the location where you split from, not some state from the past. There is code on shutdown that will remove groups from the memento that no longer exist: vscode/src/vs/workbench/browser/parts/editor/baseEditor.ts Lines 338 to 339 in 2a8c8de
I am not sure what exactly you expect how the editor memento should behave, maybe you can clarify that. |
I actually want that and isn't that how the first group behaves? Then I wonder why view state is persisted at all as it won't ever be re-used, right? |
@jrieken yes first group is special because you are not starting from a specific group, you open your first initial editor and then there is no existing state to copy from. In that case restoring from the previous one seems ok to me. |
I understand the problem with split but what I often do is |
I am not brave enough to make that change to be honest, but I added a |
Sorry, re-opening as paper cut. This is my biggest issue when working with side editors. I very often open an editor to side to look something up, then close it (with the whole group), just to re-open it very shortly after. I then have lost the view state (scroll position etc). I understand the concern of breaking existing users but this could be a setting |
Yeah I think something like this would be needed:
One scenario we would not support even if we go down this path is the following:
|
Added a new setting Enabling this setting will:
From the gif, even though new (unknown) groups are opened, the files that open within get the state that was last persisted. |
Thank you |
@mjbvz do you know the steps to verify this? |
I tried but I don't understand this, I think I am following the same steps in the gif and descriptions but it doesn't load the persisted view state and I don't see a difference with the setting on or off. |
I also tried replicating the gif. When I split the editor, another copy of the file with the same highlighting shows up. I have both the restore and share settings enabled. |
I marked this as verified based on the following test:
|
How are you doing this? I am just curious now, it doesn't really matter, but I still don't see it. For me it doesn't matter if I do a split or a "new group" and open the file |
Thanks for figuring it out, the steps are 👍 |
While working on #101356 I have noticed that
EditorMemento
has an issue because it stores stated based ongroup#id
and that keeps changing. These stepsThe capture below shows the memento for a notebook that I have opened (split) and closed a few times
The text was updated successfully, but these errors were encountered: