vscode-neovim: bug: File is edited with random edits when pressing the k movement key (vscode insiders)

Check the following:

  • I have tried setting vscode-neovim.neovimClean in VSCode settings and restarting VSCode.
  • I have read the vscode-neovim docs.
  • I have searched existing (closed!) issues.

Neovim version (nvim -v)

v0.10.3

Operating system/version

WSL with Ubuntu 22.04

Problem (including log messages)

This is the version of the extension:

Version
1.18.14
Last Updated
2024-11-23, 15:51:47

This is also happening for me with the latest insiders version:

Version: 1.97.0-insider (user setup)
Commit: 9b0b13d9bfe21c3dfd227bfaa8ed5693e309a2e0
Date: 2025-01-08T05:06:32.681Z
Electron: 32.2.7
ElectronBuildId: 10660205
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631

This is the log for when the error happens (which is all the time) 2025-01-08 143026.073 [info] MainCo.txt image

Context I have not done any custom modifications to my keyboard settings nor any modifications regarding VSCode configuration.

Steps To Reproduce

  1. Open any file
  2. Navigate through the file as usual (h, j, k, l) (normal mode of course)
  3. Press j,l,h and k and keep it pressed (at some moment … it’s random)

Expected Behavior

The cursor moves up and down in the file and the file contents remain intact.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 15 (4 by maintainers)

Most upvoted comments

WORKAROUND AVAILABLE

Add to your settings.json

"editor.experimentalEditContextEnabled": false

Ugh, I can reproduce this on Windows 11 WSL. It has started happening for me as well, with neovimClean enabled. Likely a regression in a recent nvim version. If anyone has time to bisect the nvim (or maybe vscode) version responsible that would be greatly appreciated.

I recognized this problem weeks ago, restarting the neovim extension seemed to help then. Now it seems to be worse: I only need to move like 20 lines down and up using auto repeated ‘j’ and ‘k’ keys after starting vscode with "vscode-neovim.neovimClean": true in the config. ‘j’, ‘k’ resp. is inserted randomly while moving. ‘h’, ‘l’ are also affected. edit: The problem is also there if I deactivate all extensions except the vscode-neovim extension (I restarted VSCode after deactivating the extensions to make sure they are inactive). I get no error output in the vscode-neovim log or vscode-neovim messages views.

I am using the newest VSCode Insider version on Windows 10. The severity of the problem seems to be related to the keyboard repeat rate configured in Windows. When having the repeat rate at 50% no unwanted insertion happens. At 100% it happens very often. My computer is not really fast (Intel Core I5-8500) so it might be better to reproduce with a high keyboard repeat rate and a slower computer.

For me it somehow looks like VSCode “skips” the forwarding of some key events to the vscode-neovim extension and directly puts it into the editor when it is under fire of those events. If this is something that makes sense.