Skip to content
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

Keep undo stack between file close and reopen #7169

Closed
joaomoreno opened this issue Jun 3, 2016 · 28 comments · Fixed by #92915
Closed

Keep undo stack between file close and reopen #7169

joaomoreno opened this issue Jun 3, 2016 · 28 comments · Fixed by #92915
Assignees
Labels
editor-textbuffer Editor text buffer feature-request Request for new features or functionality on-testplan undo-redo Issues around undo/redo
Milestone

Comments

@joaomoreno
Copy link
Member

joaomoreno commented Jun 3, 2016

  • Make a change in a file
  • Close it Ctrl W
  • Open it again Ctrl Shift T

Undo stack is lost 😢

@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority labels Jun 3, 2016
@joaomoreno joaomoreno added this to the June 2016 milestone Jun 3, 2016
@joaomoreno
Copy link
Member Author

Fixed recently.

@bpasero
Copy link
Member

bpasero commented Jun 3, 2016

Fixed in latest. Maybe you are still using this?

image

@joaomoreno joaomoreno reopened this Jun 10, 2016
@joaomoreno
Copy link
Member Author

Updated original steps.

@bpasero
Copy link
Member

bpasero commented Jun 10, 2016

We dispose the editor when you close it and this means we get rid of the undo stack. This needs support from the editor to store the undo stack with the editor and resource (maybe similar to storing the view state)?

@alexandrudima moving to you.

@bpasero bpasero assigned alexdima and unassigned bpasero Jun 10, 2016
@alexdima alexdima added the feature-request Request for new features or functionality label Jun 29, 2016
@alexdima
Copy link
Member

We have the content hash now, but not a serializable undo/redo stack

@alexdima
Copy link
Member

IMHO this should go on the plan rather than me doing it under the radar. @joaomoreno you can lobby for it

@alexdima alexdima removed this from the June 2016 milestone Jun 29, 2016
@joaomoreno joaomoreno added this to the Backlog milestone Jul 4, 2016
@bpasero
Copy link
Member

bpasero commented Aug 26, 2016

See also #10932

@alexdima alexdima removed bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority labels Apr 27, 2017
@alexdima alexdima changed the title Lost undo stack when jumping back to file Keep undo stack between file close and reopen Sep 27, 2017
@alexdima alexdima added the editor-core Editor basic functionality label Sep 27, 2017
@alexdima alexdima removed their assignment Sep 27, 2017
@stevensacks
Copy link

stevensacks commented Oct 27, 2017

This bug is back again. I'm using Version 1.17.2. This one bug makes VS Code almost unusable for me, since it's such a common part of my workflow.

@stevensacks
Copy link

Also broken in Insiders: Version 1.18.0-insider.

@igolskyi
Copy link

I confirm broken in version 1.18.1, also on version 1.19.0-insider

@kr094
Copy link

kr094 commented May 23, 2019

There are bugs like this one that leave vs code feeling quite unfinished as an overall product.

@phil294
Copy link

phil294 commented Jul 26, 2019

Was this ever possible at all? I am seeing conflicting statements here.

Is this a bug or a feature request?

Also see #47874.

@alexdima alexdima added editor-textbuffer Editor text buffer and removed editor-core Editor basic functionality labels Oct 21, 2019
@aloey
Copy link

aloey commented Feb 1, 2020

is there any update to this issue?

@charrondev
Copy link

Confirmed this is still not working. I prefer VSCode to Webstorm in every aspect except for this. Webstorm will keep a long running local revision history, and VSCode can't even keep it for 5 seconds after closing a file.

@skylarmb
Copy link

even vim supports this... you can close a buffer and re-open it and maintain your undo stack, or even quit vim entirely and re-open it in a different terminal and keep your undo history.

set undodir=~/.vim/tmp/backup/
set undofile

@silllli
Copy link

silllli commented Mar 4, 2020

I am also missing this feature.

The undo history is also lost when renaming a file, even if it's open.

@meboev
Copy link

meboev commented Apr 9, 2020

Oh God, please make this optional, default "on" if you want, but put an option that I can turn off. Some people like me, like to ditch the undo/redo history this way! You know, open the file clean, no undo history, etc. Existence of this feature is the main reason I hate Web Storm, and prefer VS Code, and now you are making this default here also! OMG

@sfilipov
Copy link

sfilipov commented Apr 9, 2020

Apologies for the off topic, and no disrespect to @meboev comment, but it reminded me of the following XKCD and it needs to be mentioned:

Workflow

@meboev
Copy link

meboev commented Apr 9, 2020

About the XKCD analogy... The funny thing is that it's more like the other way around. Something like, you have just fixed a bug for people with a non-working "Control + w" on their keyboard, with a permanent, non opt-out binding of the "Spacebar" anywhere in the app, interpreting its single press with a rapidly heating the CPU, making your OS freeze, thus closing the currently opened files with a hardware reboot.

@charrondev
Copy link

Oh God, please make this optional, default "on" if you want, but put an option that I can turn off. Some people like me, like to ditch the undo/redo history this way! You know, open the file clean, no undo history, etc. Existence of this feature is the main reason I hate Web Storm, and prefer VS Code, and now you are making this default here also! OMG

I view it as, I like to keep a clean list of open editors, rather than a clean undo history. The open editors (or tabs if you configure that way) are visual. The undo history is not.

I'll also note that unlike webstorm, VSCode is open source and accepts community contributions so if a configuration option isn't present you can implement one.

@phil294
Copy link

phil294 commented Apr 9, 2020

Oh God, please make this optional, default "on" if you want, but put an option that I can turn off. Some people like me, like to ditch the undo/redo history this way! You know, open the file clean, no undo history, etc. Existence of this feature is the main reason I hate Web Storm, and prefer VS Code, and now you are making this default here also! OMG

Not trying to invalidate your point, but could you please explain what you need to ditch the undo history for? Is it so that you can spam "undo" without worrying about going back further than desired?

It seems that now that this issue got closed, your best bet is probably to open up a new one. Either way you have a point, since making new features configurable is rarely a bad idea

@aj-vargas
Copy link

aj-vargas commented Apr 10, 2020

Reading the comments of past years I see how useful this new feature is for some. I always saw the bug more like a feature over WebStorm though hehe.

even vim supports this... you can close a buffer and re-open it and maintain your undo stack, or even quit vim entirely and re-open it in a different terminal and keep your undo history.

set undodir=~/.vim/tmp/backup/
set undofile

And even vim supports disabling persistent undo :)

Not trying to invalidate your point, but could you please explain what you need to ditch the undo history for? Is it so that you can spam "undo" without worrying about going back further than desired?

It's my own specific case yes, to be able to spam "undo" without worries. When I close a tab in VSCode I mean to say "I'm closing this file" not "I'm hiding this file", hitting ⌘+Z and seeing the file contents change feels like I just hid it from the view (like @charrondev mentioned). When I have multiple VSCode windows open (and several tabs on each), hitting ⌘+Z on a file without seeing changes gives me the feel that the file (of all open files/tabs) hasn't been edited since open and it's clean.

Not a dealbreaker for me tbh, but I agree with @phil294, it would be nice that these kind of features were configurable.

Anyways, somebody opened the issue #94778 requesting a configurable persistent undo.

@hd-esteban
Copy link

hd-esteban commented Apr 24, 2020

I also think it should be optional. In my case, if I close a file is because I already finished modifying it, so I don't need the history anymore. The next time I open that file I expect an empty undo/redo list, and now If change something and then I press ctrl + z by twice I can delete something or add something I wrote or deleted previously, so I my case now I need to be very careful while pressing ctrl + z, I need to check that several times to verify I didn't break anything. Also you need to think that for most of the cases people open and close their files several times while coding and this behavior could affect them as I explained, and only a very small percentage of cases would be the 'accidents' that they said. VSCode is a code editor, not a version tracker.

@dkolba
Copy link

dkolba commented Apr 27, 2020

Coming from vim, I am astonished that no one is missing this feature?! Persistent undo stacks are great for rapid prototyping - kinda like a "git lite™️". Sad to see this issue closed. 😢😭

@anstosa
Copy link

anstosa commented Apr 27, 2020

@dkolba It's closed because they added it in the March update

@dkolba
Copy link

dkolba commented Apr 28, 2020

@anstosa only if you didn't close VSCode in between edits (which completely defeats the purpose tbh).

@anstosa
Copy link

anstosa commented Apr 28, 2020

@dkolba agree that they should make it truly persistent, disagree that it defeats the purpose... I close files as part of my normal workflow and frequently want to go back to them. I never close VSCode as part of my normal workflow

@github-actions github-actions bot locked and limited conversation to collaborators May 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-textbuffer Editor text buffer feature-request Request for new features or functionality on-testplan undo-redo Issues around undo/redo
Projects
None yet
Development

Successfully merging a pull request may close this issue.