VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.89k stars 1.31k forks source link

Undo broken with new VS Code #8157

Closed marchbox closed 1 year ago

marchbox commented 1 year ago

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.

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 commented 1 year ago

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 commented 1 year ago

Same here

Elia-Darwish commented 1 year ago

Same here

magdyamr542 commented 1 year ago

saaame

visortelle commented 1 year ago

Same here.

ghost commented 1 year ago

this. same here

Niwilai commented 1 year ago

Queuing myself into the list of people experiencing this issue 👀

deedeedev commented 1 year ago

Same here.

heirenton commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Same issue... tried

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

with no luck

francescarpi commented 1 year ago

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 commented 1 year ago

Same here.

masa-08 commented 1 year ago

Same here.

J-Fields commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

magdyamr542 commented 1 year ago

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

https://user-images.githubusercontent.com/55108505/210176104-2439956b-8a36-4d2e-9baa-faa31de313cb.mp4

jsbg-hs commented 1 year ago

same here and the . repeat function is also broken

nicklozon commented 1 year ago

Same here. v1.74.2

cagataysunal commented 1 year ago

Having the same issue

alexwilkerson commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.

rivaldi8 commented 1 year ago

The issues #8200 and #8201 seem to have appeared at the same time as this one. Is someone else affected by them? Has someone been able to reproduce the issue starting from a clean VS Code configuration? I'm trying, but with no success so far.

@J-Fields I'm still having the issue. This is my settings.json:

{
    "vim.vimrc.enable": true,
    "files.autoSave": "onFocusChange",
    "javascript.format.semicolons": "insert",
    "editor.rulers": [
        80,
        100
    ],
    "eslint.alwaysShowStatus": true,
    "eslint.format.enable": true,
    "eslint.lintTask.enable": true,
    "editor.fontFamily": "'JetBrains Mono', 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",
    "editor.fontLigatures": true,
    "editor.fontWeight": 600,
    "vim.hlsearch": true,
    "vim.timeout": 0,
    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": [
                "gq"
            ],
            "commands": [
                "editor.action.formatSelection",
            ],
        }
    ],
    "python.linting.pylintEnabled": true,
    "editor.minimap.enabled": false,
    "workbench.tree.indent": 20,
    "workbench.list.horizontalScrolling": true,
    "gitlens.fileAnnotations.command": "blame",
    "gitlens.currentLine.enabled": false,
    "gitlens.currentLine.pullRequests.enabled": false,
    "gitlens.currentLine.scrollable": false,
    "gitlens.codeLens.authors.enabled": false,
    "gitlens.codeLens.recentChange.enabled": false,
    "gitlens.codeLens.enabled": false,
    "git.autofetch": "all",
    "git.inputValidationSubjectLength": 72,
    "typescript.updateImportsOnFileMove.enabled": "always",
    "workbench.editor.wrapTabs": true,
    "window.openFilesInNewWindow": "on",
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "terminal.integrated.scrollback": 10000,
    "[typescript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "gitlens.advanced.messages": {
        "suppressCreatePullRequestPrompt": true
    },
    "window.openFoldersInNewWindow": "on",
    "[html]": {
        "editor.defaultFormatter": "vscode.html-language-features"
    },
    "javascript.updateImportsOnFileMove.enabled": "always",
    "workbench.colorTheme": "Default Light+",
    "cSpell.userWords": [
        "fdescribe",
        "testid",
        "upsert",
        "upserted"
    ],
    "cSpell.ignoreRegExpList": [
        "/from\\s+(['\\\"]).*\\1/"
    ],
    "editor.inlineSuggest.enabled": true,
    "editor.bracketPairColorization.independentColorPoolPerBracketType": true,
    "[scss]": {
        "editor.defaultFormatter": "sibiraj-s.vscode-scss-formatter"
    },
    "outline.showVariables": false,
    "editor.cursorBlinking": "smooth",
    "javascript.inlayHints.enumMemberValues.enabled": true,
    "javascript.inlayHints.parameterNames.enabled": "literals",
    "typescript.inlayHints.parameterNames.enabled": "literals",
    "editor.foldingImportsByDefault": true,
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "workbench.editor.enablePreview": false,
    "typescript.preferences.quoteStyle": "single",
    "javascript.preferences.importModuleSpecifier": "project-relative",
    "diffEditor.ignoreTrimWhitespace": false,
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "terminal.integrated.allowChords": false,
    "window.customMenuBarAltFocus": false,
    "window.enableMenuBarMnemonics": false,
    "vim.handleKeys": {
        "<C-d>": true,
        "<C-s>": false,
        "<C-z>": false,
        "<C-f>": false
    },
    "vim.leader": "Ñ",
    "vim.matchpairs": "(:),{:},[:],<:>,\":\",/*:*/",
    "vim.replaceWithRegister": true,
    "vim.visualstar": true,
    "jest.autoRun": "off",
    "gitlens.advanced.fileHistoryFollowsRenames": true,
    "editor.stickyScroll.enabled": true
}
magdyamr542 commented 1 year ago

so is this gonna be addressed?

rivaldi8 commented 1 year ago

@magdyamr542 I hope so :) However, it seems there isn't a way to reproduce it consistently. I'm having trouble myself to reproduce it in one of my computers. So, if you could provide any information, such as environment, settings, plugins, steps, etc. to reproduce it, it should make it much easier for the developers to find a fix. Thanks!

magdyamr542 commented 1 year ago

@rivaldi8. Sure. This is the info from the about command in vscode. There are no certain steps to follow in my case, it just doesn't work :D. I have provided a video of what it looks like. https://github.com/VSCodeVim/Vim/issues/8157#issuecomment-1368468942. It works with version 1.73. for me. Starting from 1.74. it doesn't work.

Version: 1.74.1 Commit: 1ad8d514439d5077d2b0b7ee64d2ce82a9308e5a Date: 2022-12-14T10:35:03.979Z Electron: 19.0.17 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: No

gladevise commented 1 year ago

Until this issue is resolved, VSCode undo, redo can be temporarily set to Vim key bindings.

"vim.normalModeKeyBindingsNonRecursive": [
    // Undo & Redo
    { "before": ["u"], "commands": ["undo"] },
    { "before": ["c-r"], "commands": ["redo"] }
  ],
BlazeIsClone commented 1 year ago

Same here the key "u" doesn't align with VScode's undo history :(

sethawright commented 1 year ago

@gladevise Unfortunately did not have any luck with those bindings. It works for a while and periodically the same issue will appear.

gladevise commented 1 year ago

@sethawright

I apologise for the confusion caused by the uncertain information. But so far this has worked well in my environment. Under what conditions does VSCode undo and redo not work?

sethawright commented 1 year ago

@gladevise No worries! Maybe we have different plugins or something causing conflict — I'll try to get to the bottom of it if I have time. Appreciate the help.

Niwilai commented 1 year ago

@gladevise Unfortunately did not have any luck with those bindings. It works for a while and periodically the same issue will appear.

Same for me. I tried those bindings but the error would come up occasionally. Good thinking though.

imyhxy commented 1 year ago

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.

Yes, the u always remain a character from last input and <Ctrl-r> is not working.

ihello<Esc>: hello
u: h
<Ctrl-r>: h
iello<Esc>: hello
u: he
soloradish commented 1 year ago

When I press u, vscode undo to the latest change, and if press u again nothing happend.

kenryu42 commented 1 year ago

I am using VS Code 1.75.0 and still encounter this problem. I downgraded the VsCodeVim version to 1.1.0 to fix it for now.

alecthomas commented 1 year ago

Strangely I just started experiencing this today, though presumably I have been on 1.75.0 since it released. Downgrading to 1.72.2 as someone above recommended seems to fix it.

guzy0324 commented 1 year ago

Same here

版本: 1.75.0 (user setup)
提交: e2816fe719a4026ffa1ee0189dc89bdfdbafb164
日期: 2023-02-01T15:23:45.584Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Windows_NT x64 10.0.22621
沙盒化: No
guzy0324 commented 1 year ago

Same here

版本: 1.75.0 (user setup)
提交: e2816fe719a4026ffa1ee0189dc89bdfdbafb164
日期: 2023-02-01T15:23:45.584Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Windows_NT x64 10.0.22621
沙盒化: No

Downgrading to 1.73.1 fix the bug.

ddnomad commented 1 year ago

Same issue here, latest update broke things again

SaadJlil commented 1 year ago

same issue. Quite strange since I've been using the same version for some time now

lperson commented 1 year ago

Same issue (intermittently). I noticed it yesterday for the first time. I updated to macOS Ventura 13.1 (from Monterey) on Saturday.

Version: 1.75.0 (Universal) Commit: e2816fe719a4026ffa1ee0189dc89bdfdbafb164 Date: 2023-02-01T15:24:42.903Z (4 days ago) Electron: 19.1.9 Chromium: 102.0.5005.194 Node.js: 16.14.2 V8: 10.2.154.23-electron.0 OS: Darwin x64 22.2.0 Sandboxed: Yes

bryan-gc commented 1 year ago

Same issue, using Ubuntu, Vscode 1.75.0 anv VsCodVim 1.24.3

igniscyan commented 1 year ago

Same issue here. Any ack from the devs yet?

acidjazz commented 1 year ago

+1 this is insanely annoying

lishujun5 commented 1 year ago

+1 +1 +1