Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Pressing `u` will undo all the stack.

Open yacinehmito opened this issue 7 years ago β€’ 169 comments

  • Click thumbs-up πŸ‘ on this issue if you want it!
  • Click confused πŸ˜• on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


Is this a BUG REPORT or FEATURE REQUEST? (choose one): This is a bug report

Environment:

  • VSCode Version: 1.15.1
  • VsCodeVim Version: 0.10.0
  • OS: macos 10.12.6

What happened:

I press uin Normal mode in an editor window. Every single action in the undo stack was undone. Here's a GIF:

bug vscode

What did you expect to happen:

I expected the last action on the stack to be undone.

How to reproduce it:

I have no idea. I was reliably triggering the bug with the exact buffer I had but at some point it stopped doing it. Then it did it again.

yacinehmito avatar Sep 06 '17 20:09 yacinehmito

And now it's doing it again in another project. When I reloaded the project the bug stopped.

The only similarity between the two instances of the bug is that it happened both times on an HTML-like file (first time on a vue file; second time on a proper html file).

This is the list of the extensions that I have installed and their versions:

  • Auto Close Tag 0.4.3
  • Auto Rename Tag 0.0.14
  • Code Runner 0.7.1
  • Debugger for Chrome 3.2.1
  • EditorConfig 0.10.1
  • ESLint 1.2.11
  • Git History (git log) 0.2.3
  • Git Lens 4.4.3
  • HTML Snippets 0.1.0
  • JavaScript (ES6) code snippets 1.4.1
  • Nix 1.0.1
  • npm 0.2.1
  • npm Intellisense 1.3.0
  • Path Intellisense 1.4.2
  • Search node_modules 1.1.1
  • stylelint 0.29.0
  • Vetur 0.9.7
  • Vim 0.10.0
  • vscode-icons 7.12.0

yacinehmito avatar Sep 09 '17 11:09 yacinehmito

Having same issue

Extension List

  • Beautify css/sass/scss/less 1.7.2
  • Color Picker 0.4.5
  • HTML CSS support 0.1.8
  • HTML Snippets 0.1.0
  • IntelliSense for CSS class names 1.10.0
  • Javascript ES6 Code Snippets 1.4.1
  • Live Server 2.1.1
  • Node.js Modules IntelliSense 1.4.0
  • npm 0.2.1
  • npm IntelliSense 1.3.0
  • TODO highlight 0.5.11
  • Vim 0.10.0

ryanpag3 avatar Sep 14 '17 00:09 ryanpag3

Putting this inside vim.otherModesKeyBindings is a good temporary fix if this is a big issue for you:

        {
            "before": [
                "u"
            ],
            "after": [],
            "commands": [
                {
                    "command": "undo"
                }
            ]
        },
        {
            "before": [
                "<C-r>"
            ],
            "after": [],
            "commands": [
                {
                    "command": "redo"
                }
            ]
        }

Chillee avatar Sep 15 '17 02:09 Chillee

@Chillee I think you meant to say

"before": [
  "<C-r>"
],

for the redo.

petejkim avatar Sep 15 '17 17:09 petejkim

@petejkim You're correct! Thanks!

Chillee avatar Sep 15 '17 17:09 Chillee

Terrible, confusing behavior. I cannot tell what has been undone, more times than not it's too much. Please make it VIM-like

Thanks @Chillee for the fix. This is better than the default behavior, too much is better than too little. Is there a way to have this undo block edits, etc?

drice avatar Sep 22 '17 16:09 drice

@tbsf We try, but unluckily bug-free software is hard to write :(

I don't believe so. Not without a significant amount of work.

Chillee avatar Sep 26 '17 15:09 Chillee

Is anyone here NOT using enableNeovim? Just want to rule that out...

xconverge avatar Sep 27 '17 01:09 xconverge

vim.enableNeovim is set to false for me

drice avatar Sep 27 '17 15:09 drice

Great thanks, just wanted to make sure

xconverge avatar Sep 27 '17 16:09 xconverge

Next time this happens to someone, can you check to see if you have the same file open twice in vscode please, then either thumbs up this for yes, or thumbs down it for no

xconverge avatar Sep 28 '17 01:09 xconverge

I can confirm this bug as well:

Runtime:

  • VSCode: 1.15.1
  • Mac 10.12.6

Extensions:

  • Editor Config: 0.10.1
  • Prettier: 0.21.1
  • ESLint: 1.3.2
  • Vim: 0.10.1

Only custom vim settings are:

"vim.disableAnnoyingNeovimMessage": true,
"vim.useSystemClipboard": true,

I did not have two copies of the file open (voted above)

justinaray avatar Sep 28 '17 19:09 justinaray

I had the issue too and the temporary fix with the keyBindings seems to help. It's a very disturbing behavior to me as ViM is my main editor. I basically did the clicks to undo stuff for a while because of that bug...

cecton avatar Oct 06 '17 12:10 cecton

No actually the temporary fix of @Chillee is still not the behavior of ViM. If you are in insert mode and remove character with backspace, go to normal mode and press u, every character will be undo one by one.

cecton avatar Oct 06 '17 15:10 cecton

I also have this bug. I am disabling this plugin for now. Looking forward to a fix.

I press u and all characters in the document are deleted one by one.

jakkan avatar Oct 07 '17 18:10 jakkan

FWIW, I also am experiencing this bug. Hitting undo is like rolling the dice.

jcjolley avatar Oct 12 '17 20:10 jcjolley

@cecton Yes, unluckily it's a temporary fix that's not very good. It's why we haven't rolled it out as a default.

Chillee avatar Oct 12 '17 23:10 Chillee

@Chillee still you and all the contributors are doing an amazing job with this plugin. Thanks πŸ‘ I think Vi is a really complicate editor to emulate the behavior.

I use some times a "normal" editor on other's computer but I have grown so much with Vi that anything else feels cumbersome to use.

cecton avatar Oct 13 '17 13:10 cecton

I've been evangelizing VS Code at my office for the past few months for TypeScript work. Most of us use vim, and this fantastic plugin is key to VSCode being a viable option at all. Fantastic work!

However, this issue is a huge pain for many of us. I've paired with at least 5 people who have run into this issue and considered switching editors as a result. It is by far our number one pain point with VS Code. I've asked on our slack channel for others to upvote this issue, but I can say for certain that I know close to ten other people directly who feel pain from this issue.

Hopefully this issue is still on the radar.

dcolthorp avatar Dec 19 '17 17:12 dcolthorp

This happened to me last night. It's very scary seeing your editor deleting lines that was not supposed to delete and you haven't add the file to VCS yet.

Please if possible prioritize this bug!

yegle avatar Dec 21 '17 16:12 yegle

Happy to help debug it – it might be a conflict with another extension?

bsaf avatar Dec 21 '17 16:12 bsaf

Just nuked like an hour of work in front of my eyes. I am very sad.

I have fresh VS Code with ESlint, Vetur, Vim, that's it. I only had one copy of the file open.

Version 1.19.1 (1.19.1) OSX High Sierra

lmiller1990 avatar Dec 29 '17 14:12 lmiller1990

My installed plugins re https://github.com/VSCodeVim/Vim/issues/2007#issuecomment-353399493

  • AutoHotKey
  • Bracket Pair Colorizer
  • Go
  • Vim

yegle avatar Dec 29 '17 15:12 yegle

@lmiller1990 If it happens to you again don't panic and just press βŒƒR. Then βŒ˜β‡§P and look for the Reload Window command. That should fix it.

yacinehmito avatar Dec 29 '17 17:12 yacinehmito

Given the information we have I think we can safely say that it is not caused by some conflict with another extension, but rather with how VSCodeVim handles the Undo stack.

Now that I've had this bug more times than I can count, in various situations, my guess would be that VSCodeVim identifies all the changes as a single action. The bug wouldn't be in the Undo itself but with the way the extension determines the boundary between two undoable actions.

yacinehmito avatar Dec 29 '17 17:12 yacinehmito

Just ran into this issue, lost 45 minutes of work. I clicked the πŸ˜• but, honestly, this makes all of VSCode unusable, not just the plugin, because not having reliable vim keybindings in my editor is a deal breaker for me.

tctimmeh avatar Jan 29 '18 16:01 tctimmeh

I've still never run into this problem, but I'll commit to spending a chunk of time in a couple days either fixing this issue (hopefully), or at least implementing some kind of failsafe to prevent it from deleting so much work :(

Chillee avatar Jan 29 '18 16:01 Chillee

I opened an issue on another plugin thinking the bug was there, but now reading this I'm starting to think it's here. This is the specific combination that seems to kick it off. Neither seem to cause the issue I'm seeing on their own.

  • Vim 0.10.13
  • Parinfer 0.6.1

Here's what happened. I was changing some user settings, then clicked over to a Clojure file. Parinfer asked me if I wanted to let it reformat the document (it needs to be formatted in a certain way for it to work) so I said yes. Everything seemed to be fine, then I started editing the file, made a mistake, hit ESC then u, and suddenly my whole file didn't just get nuked, but got replaced by my user settings file. I panicked and quit, but of course my VS Code autosaves on quit, so I nearly lost that file. Some state of it happened to still be in memory, so I was able to recover it, but it nearly gave me a heart attack.

I hadn't had any issues with the Vim port yet, so I figured it was Parinfer, and when I disabled it, the issue went away. Then I tried again today, and saw the same problem (committed my changes first so I wouldn't lose anything). This time it replaced it with my .gitignore. I'm pretty sure the only correlation there is that it was the first file I edited upon opening the app.

So, I opened an issue on Parinfer about it, but I'm also thinking it might be related to this issue as well.

jonlaing avatar Jan 31 '18 02:01 jonlaing

Thanks for the work on this plugin! I love VS Code and this plugin makes it supremely useful for me.

I've had a similar problem in the last few days where the contents of a file I was editing were replaced, character by character, with a package.json file I had open in the same project when I typed u.

smerrill avatar Jan 31 '18 22:01 smerrill

This issue happened twice to me today, similar to @smerrill

KarboniteKream avatar Jan 31 '18 22:01 KarboniteKream