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

Undo broken with new VS Code #8157

Closed
marchbox opened this issue Dec 8, 2022 · 159 comments
Closed

Undo broken with new VS Code #8157

marchbox opened this issue Dec 8, 2022 · 159 comments

Comments

@marchbox
Copy link

marchbox commented Dec 8, 2022

Type: Bug

I just upgraded to VS Code 1.74.0 today, and started noticing an issue with undo command ("u") in Vim. It appears to only go back 2-3 iterations (my current Vim: History setting is "50"). And if I hit CTRL+Z, it first undoes what "u" just undid, then start actually undoing, e.g.

  • i → insert mode
  • a → "a"
  • b → "ab"
  • ESC → normal mode
  • u → "a"
  • u → nothing happens, but should've undone "a"
  • CTRL-Z → "ab" (undoes what u just undid)
  • CTRL-Z → "a"
  • CTRL-Z → ""

Here is my VS Code info:
Version: 1.74.0 (Universal)
Commit: 5235c6bb189b60b01b1f49062f4ffa42384f8c91
Date: 2022-12-05T16:43:37.594Z (2 days ago)
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 21.6.0
Sandboxed: No

Extension version: 1.24.3
VS Code version: Code 1.74.0 (Universal) (5235c6bb189b60b01b1f49062f4ffa42384f8c91, 2022-12-05T16:43:37.594Z)
OS version: Darwin arm64 21.6.0
Modes:
Sandboxed: No

System Info
Item Value
CPUs Apple M1 Max (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 2, 2, 2
Memory (System) 64.00GB (32.10GB free)
Process Argv --crash-reporter-id 934e8b32-9713-4d8f-957f-354420e03177
Screen Reader yes
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263cf:30335440
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
pyindex848:30577860
nodejswelcome1:30587005
2e4cg342:30602488
gswce1:30612156
iaj6b796:30613358
dbltrim-noruby:30604474
89544117:30613380
fim-prod:30623723
ejf25101:30620729

@weiying-chen
Copy link

weiying-chen commented Dec 9, 2022

I'm having this same problem ... I'm using VS Code 1.74.0-insider.
I'm using Ubuntu, so I don't think this is OS related.

@Saul-Mirone
Copy link

Same here

1 similar comment
@Elia-Darwish
Copy link

Same here

@magdyamr542
Copy link

saaame

@visortelle
Copy link

Same here.

@ghost
Copy link

ghost commented Dec 16, 2022

this. same here

@Niwilai
Copy link

Niwilai commented Dec 16, 2022

Queuing myself into the list of people experiencing this issue 👀

@deedeedev
Copy link

Same here.

  • VS Code 1.74.0
  • Ubuntu 22.04
  • vscodevim 1.24.3

@heirenton
Copy link

Same here.

vscodevim v1.24.3
Version: 1.74.1 (user setup)
Commit: 1ad8d514439d5077d2b0b7ee64d2ce82a9308e5a
Date: 2022-12-14T10:30:51.966Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.19045
Sandboxed: Yes

@paulburlumi
Copy link

I'm seeing the same here on Ubuntu.

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy

vscodevim v1.24.3
Version: 1.74.1
Commit: 1ad8d514439d5077d2b0b7ee64d2ce82a9308e5a
Date: 2022-12-14T10:35:03.979Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 5.15.0-56-generic
Sandboxed: Yes

@sethawright
Copy link

Same issue... tried

    {
      "before": ["u"],
      "commands": ["undo"]
    },
    {
      "before": ["r"],
      "commands": ["redo"]
    }

with no luck

@francescarpi
Copy link

Same here

Versión: 1.74.2
Commit: e8a3071ea4344d9d48ef8a4df2c097372b0c5161
Fecha: 2022-12-20T10:32:21.587Z
Electrón: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 22.2.0
En espacio aislado: No

@ingemar
Copy link

ingemar commented Dec 23, 2022

Same here.

1 similar comment
@masa-08
Copy link

masa-08 commented Dec 26, 2022

Same here.

@J-Fields
Copy link
Member

I'm a bit confused... iab<Esc>u should undo the entire insertion ("ab", not just "a"), which is what I'm seeing, at least on VS Code 1.74.2.

If anyone is still experiencing this, please post settings.

@renthog
Copy link

renthog commented Dec 29, 2022

I'm a bit confused... iab<Esc>u should undo the entire insertion ("ab", not just "a"), which is what I'm seeing, at least on VS Code 1.74.2.

If anyone is still experiencing this, please post settings.

I don't think this is the case being described. The issue seems to appear if you save the file.

o1<Esc>:w<Enter>o2<Esc>uu will only undo the "2".

@marchbox
Copy link
Author

It seems this issue is fixed now, at least in my VS Code 1.74.2.

Version: 1.74.2 (Universal)
Commit: e8a3071ea4344d9d48ef8a4df2c097372b0c5161
Date: 2022-12-20T10:26:09.430Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 22.3.0
Sandboxed: No

@slnc
Copy link

slnc commented Dec 31, 2022

It seems this issue is fixed now, at least in my VS Code 1.74.2.

Version: 1.74.2 (Universal) Commit: e8a3071ea4344d9d48ef8a4df2c097372b0c5161 Date: 2022-12-20T10:26:09.430Z Electron: 19.1.8 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin arm64 22.3.0 Sandboxed: No

@marchbox are you able to undo changes with "u" after saving a file? I can still reproduce that issue with 1.74.2. which may be related to this. The last version where that worked for me is 1.72.2, see #8188.

@visortelle
Copy link

visortelle commented Dec 31, 2022

It seems this issue is fixed now, at least in my VS Code 1.74.2.

It still doesn't work in my VS Code 1.74.2.

@marchbox
Copy link
Author

@slnc @visortelle yeah I was able to undo after saving (both with :w and CMD+S)

@magdyamr542
Copy link

magdyamr542 commented Jan 1, 2023

Undo after saving the file or even before saving it doesn't work for me as it used to do before the bug. VS Code 1.74.2

vscode-problem-vim-undo.mp4

@jsbg-hs
Copy link

jsbg-hs commented Jan 3, 2023

same here and the . repeat function is also broken

@nicklozon
Copy link

Same here. v1.74.2

@cagataysunal
Copy link

Having the same issue

@alexwilkerson
Copy link

alexwilkerson commented Jan 6, 2023

It's working again for me in v1.74.2. I uninstalled VSCodeVim, reloaded VS Code, then reinstalled the extension.

edit: annnnd it stopped working again

@nicklozon
Copy link

Seeing mixed messages here of it working and not working. It's intermittent - sometimes it works, sometimes it doesn't. It's almost something is happening upon save that is sometimes erasing history. Seems to be completely random - I've typed and re-typed the same text over and over again, and it is about 50/50 chance of remembering history after a save.

@ManicMunchkin
Copy link

Same for me with VSCode Version 1.74.2
I cannot undo any change done in normal mode without having to use C-z.
VscodeVim undo states 'Already at oldest change' even without saving inbetween.

@rtviii
Copy link

rtviii commented Feb 22, 2023

Looking forward to the resolution.

@ewsandor
Copy link

I am seeing this issue as well.

VSCodeVim Version:
v1.24.3

VSCode Version:
Version: 1.75.1
Commit: 441438abd1ac652551dbe4d408dfcec8a499b8bf
Date: 2023-02-08T21:35:30.018Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Linux x64 6.1.11-200.fc37.x86_64
Sandboxed: No

@joehillen
Copy link

@alecthomas Don't comment on GitHub issues with "Same" or "+1". It's rude, unhelpful, and spams everyone who is following the issue.

@igniscyan
Copy link

@alecthomas Don't comment on GitHub issues with "Same" or "+1". It's rude, unhelpful, and spams everyone who is following the issue.

This has been said upwards of 10 times on this thread. This is equally as useful as a +1 comment, pings everyone, and is intentionally contentious.

@alecthomas
Copy link

@joehillen In addition to what @igniscyan said, you also @ed the wrong person...

@lperson
Copy link

lperson commented Feb 28, 2023

@alecthomas Don't comment on GitHub issues with "Same" or "+1". It's rude, unhelpful, and spams everyone who is following the issue.

This comment is not useful.

@ddnomad
Copy link

ddnomad commented Feb 28, 2023

@alecthomas Don't comment on GitHub issues with "Same" or "+1". It's rude, unhelpful, and spams everyone who is following the issue.

Right, better let the issue disappear in the ether of obscurity, or get automatically closed as stale. Giving the maintainers a nudge that the issue affects a lot of people is clearly a step in a wrong direction 😛

@ianchanning
Copy link

sporadically maintained open source project

@lperson I've pointed this out to others - but this has been an amazingly well maintained project. It currently stands at 4,085 closed issues. That's phenomenal. I think it has reduced down to just one developer working on it.

So if this is sporadically maintained, all open source is sporadically maintained.

Either:

  1. Have patience
  2. Use the work-around
  3. Fork it
  4. Use something else

But don't go around insulting the project owners.

@lperson
Copy link

lperson commented Feb 28, 2023

That's not an insult. It's a fact.

@ianchanning
Copy link

'sporadic' is an opinion

@ianchanning
Copy link

You will also note that @J-Fields is working on a fix - #8249

So everyone else be patient

@t-var-s
Copy link

t-var-s commented Feb 28, 2023

I'm trying this workaround:

    {
      "commands" : [ "undo" ],
      "before" : [ "<leader>", "u" ]
    }

and although the issue comes and go it seems to be able to undo when u doesn't.

@aromeronavia
Copy link

@t-var-s can't find the comment that fixed this, but just try this:

  "vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": ["u"],
      "commands": ["undo"]
    },
    {
      "before": ["c-r"],
      "commands": ["redo"]
    }
  ],

@t-var-s
Copy link

t-var-s commented Feb 28, 2023

@aromeronavia For me, "before": ["u"] doesn't work with the undo command but something like "before" : [ "<leader>", "u" ] seems to be working.

J-Fields added a commit that referenced this issue Mar 1, 2023
The issue is pretty clearly that a recent VS Code update caused `onDidChangeTextDocument` events to be created (unreliably, from my testing) in such a way that trips our "change from disk" logic. We respond to that situation rather pessimistically by throwing out our undo stack, rather than trying to do something clever.
I haven't had the time lately to dig into the nitty gritty details of what changed on VS Code's side, so this is a bit of a shot in the dark.
The "change from disk" logic has caused issues in the past and I'm not sure how to reliably make it work, so I'm just deleting it for now. This may cause problems in some edge cases, but judging by my dogfooding, that'll be much less disruptive than losing your undo stack frequently enough that you can't trust it.
@J-Fields
Copy link
Member

J-Fields commented Mar 1, 2023

Apologies for my slowness in responding to this issue; I've been quite busy with other things recently.

This should be fixed in v1.25.1. If you're still experiencing this issue, please leave a comment letting me know. If there's some other misbehavior related to undo, please file a new ticket.

@J-Fields J-Fields closed this as completed Mar 1, 2023
@huyz
Copy link
Contributor

huyz commented Mar 2, 2023

@J-Fields thank you for letting me unsubscribe from this embarrassing whine-fest 😜

@alecthomas
Copy link

Thanks @J-Fields, I really appreciate the effort that you've put into this extension, it's amazing.

@iddm
Copy link

iddm commented Mar 2, 2023

Apologies for my slowness in responding to this issue; I've been quite busy with other things recently.

This should be fixed in v1.25.1. If you're still experiencing this issue, please leave a comment letting me know. If there's some other misbehavior related to undo, please file a new ticket.

Thank you, but I can't see it in the extensions repository of vscode. Have you published it?

@skplunkerin
Copy link

Thank you, but I can't see it in the extensions repository of vscode. Have you published it?

There's been 2 new versions released recently, I can see both of them in VSCode so they have been released (checkout the version history on the VSCodeVim extension page here).

In VSCode you can also check the versions by right clicking on the extension -> click Install Another Version and see the available versions; if you don't see them you might need to make sure VSCode is updated or maybe restart it? Or connect to the internet? 😄 🤷

@iddm
Copy link

iddm commented Mar 2, 2023

Thank you, but I can't see it in the extensions repository of vscode. Have you published it?

There's been 2 new versions released recently, I can see both of them in VSCode so they have been released (checkout the version history on the VSCodeVim extension page here).

In VSCode you can also check the versions by right clicking on the extension -> click Install Another Version and see the available versions; if you don't see them you might need to make sure VSCode is updated or maybe restart it? Or connect to the internet? smile shrug

I have already done everything you suggested except for first upgrading to the latest vscode and then checking, perhaps, this is the reason I couldn't see the new version. :-)

@t-var-s
Copy link

t-var-s commented Mar 2, 2023

Thank you for the fix 👍

@marchbox
Copy link
Author

marchbox commented Mar 2, 2023 via email

@J-Fields J-Fields unpinned this issue Mar 12, 2023
@hawkiboy
Copy link

hawkiboy commented Oct 3, 2023

Still broken for me in version 1.26.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests