vscode-neovim: bug: vscode-neovim is repeatedly locking up in Insert Mode and not responding to ESC or Ctrl-[ to return to Normal Mode
Check the following:
- I have tried setting
vscode-neovim.neovimCleanin VSCode settings and restarting VSCode. - I have read the vscode-neovim docs.
- I have searched existing (closed!) issues.
Neovim version (nvim -v)
NVIM v0.10.1 (0.10.1+g7e194f0d0)
Operating system/version
Windows 10
Problem (including log messages)
I’m repeatedly getting stuck in Insert Mode. During a typical dev session (6-8 hours) this occurs 1-3 times, nvim will refuse to leave insert mode. Both ESC and Ctrl-[ fail to work and, if I move to other tabs, they will also be stuck in insert mode. My only recourse is to Save via the menu and run ‘Developer: Reload Window’ which becomes rather annoying. I always run with ‘vscode-neovim.neovimClean’ set with no local config changes to nvim (as vanilla as you can get).
I have attached all of the log entries from today. I didn’t see anything out of the ordinary, unfortunately. I’ll update the issue when I check the logs while experiencing the issue again. vscode-neovim-excerpt.log
My Setup: Windows 10 [vscode 1.93.1|nvim 0.10.1|vscode-neovim 1.18.12]—REMOTE—>Ubuntu 22.04 Server
Steps To Reproduce
- Install/Config Windows 10 [vscode 1.93.1|nvim 0.10.1|vscode-neovim 1.18.12]—REMOTE—>Ubuntu 22.04 Server
- Edit python file moving between modes
- Within 3 hours, Stuck in Insert Mode will occur
- Reload Window, rinse and repeat
Expected Behavior
nvim will allow normal editing, traversal between modes, and vim motions. Other than this issue, this is what I normally observe and expect. It is only recently that this lockup has started occurring. With documented exceptions, I expect it to behave similar to vanilla nvim in a terminal.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 6
- Comments: 15 (1 by maintainers)
I seems that switching between github co-pilot and the editor window always triggers this issue. Also auto complete triggers this issue sometimes.
This may be a loop in the logger: updating the Output channel triggers something that logs, which then updates the Output channel, and so on…
Please try setting your vscode-neovim log-level to “error” (instead of “debug”/“info”/etc).
Proposal
BufModifiedSetautocmd that callsVSCodeExtensionNotify. We can probably fix that particular case easily.I’m getting this, too. Before the update it happened once in a while with a stuck “syncing editors”, now after the update it’s happening so often I now have to disable the extension.
The OptionSet problem is gone.
But vscode-neovim still get stuck.
I noticed: when switch the focus from edit-tab to output-tab, I get tones of the log messages below. But since I’m getting stuck a lot without leaving the edit-tab, this is IMO unrelated.
vscode-neovim 1.18.13 includes an attempted fix for this issue. Please restart vscode and confirm that you are running vscode-neovim 1.18.13 , then report here if there is any improvement.
Thanks to @aFreimuthQby for providing useful logs! https://github.com/vscode-neovim/vscode-neovim/pull/2282 should address this issue. We can keep https://github.com/vscode-neovim/vscode-neovim/issues/2184 open to track the lower-level question about how/why vscode-neovim might be sending malformed RPC messages to node-client.
a solution was already proposed: https://github.com/vscode-neovim/vscode-neovim/issues/2267#issuecomment-2381694486
now waiting on someone to implement it. the extra reports aren’t helping.
Even so, these functions should bail (and log a one-time warning) if they notice they’r going in a loop, regardless of the cause.
Fwiw you can run “restart neovim” without reloading the window – that should save you some hassle.
I will say I’ve also experienced this issue on windows 10 WSL…
I am not an LUA developer, so tell me what I can do to help.
I just investigated further, and discovered, the Loop apparently starts as soon as I enter insert mode, stops when I leave it.
It also appears to be unrelated to getting stuck.
When I activating an Editor Tab I find errors like this in ‘exthost.log’:
The last 4 times when I was stuck I had this messages in the ‘exthost.log’:
My
init.vimlooks like this:Edit: Most of the times when I am stuck I see: “Syncing layout: Syncing active editor”, but not always.
In VSCode, identical option settings do not trigger change events, so they won’t cause loops. When writing this part of the logic earlier, I intentionally simplified it by skipping the checks. I recommend debugging first to identify under what conditions the options are being modified frequently. Typically, many people prefer to disable relative line numbers in insert mode and enable them in other modes.