Describe the bug
Certain commands trigger the error:
TaskQueue: Error running task. Failed to handle key=<right>. Cannot read property 'mightChangeDocument' of undefined.
To Reproduce
Steps to reproduce the behavior:
c is mapped to "_c. cw in normal mode and then pressing the right arrow key results in the error above.Expected behavior
No error :-)
Environment (please complete the following information):
I keep getting the same error when I press Esc (to leave insert mode) followed by one of the arrow keys (I never got into using hjkl).
I get this error any time I press the right or left arrow keys in insert mode.
Unfortunately I haven't been able to reproduce. Would someone mind posting their settings?
Here you go. I've also attached a screenshot of the offending error.
~ json
{
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "One Dark Pro",
"vim.insertModeKeyBindings": [
{
"before": ["j", "j"],
"after": ["
}
],
"editor.tabSize": 2,
"emmet.includeLanguages": { "erb": "html", "jsx": "react" },
"rubyTestExplorer.testFramework": "rspec",
"testExplorer.addToEditorContextMenu": true,
"rubyTestExplorer.minitestDirectory": "spec",
"rubyTestExplorer.rspecCommand": "./bin/rspec",
"editor.fontSize": 14,
"editor.minimap.enabled": false,
"breadcrumbs.enabled": false,
"vim.highlightedyank.enable": true,
"vim.statusBarColorControl": true,
"vim.useSystemClipboard": true,
"vim.visualstar": true,
"workbench.colorCustomizations": {
"statusBar.background": "#005f5f",
"statusBar.noFolderBackground": "#005f5f",
"statusBar.debuggingBackground": "#005f5f"
},
"git.autofetch": true,
"workbench.editor.enablePreview": false,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"window.zoomLevel": 0,
"git.enableSmartCommit": true,
"explorer.confirmDragAndDrop": false,
"workbench.editor.limit.enabled": true,
"workbench.editor.limit.value": 8,
}
~

My settings are below. I can't reproduce the error on demand, it just happens occasionally, and I haven't worked out what special conditions trigger it, if any. I've searched the logs:
grep -Ri mightChangeDocument Library/Application\ Support/Code/logs/
but got no hits. Would we get more information by clicking the gear icon in the notification dialog or something? I'm sure it would help if we were able to tell you which line of code this is coming from.
{
"editor.rulers": [80],
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["Y"],
"after": ["y", "$"]
},
{
"before":["<C-n>"],
"commands": [
":nohl"
]
},
{
"before": ["Q"],
"commands": [
":q"
]
},
{
"before": ["Z", "Z"],
"commands": [
":wq"
]
},
{
"before": ["leader", "w"],
"commands": [
"workbench.action.files.save"
]
}
],
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.acceptSuggestionOnEnter": "off",
"editor.fontFamily": "Hack, Menlo, Monaco, monospace",
"editor.fontSize": 13,
"files.autoSave": "onFocusChange",
"python.autoComplete.extraPaths": [
"/Users/tony/.cache/fakegir"
],
"explorer.confirmDelete": false,
"git.enableSmartCommit": true,
"editor.minimap.enabled": false,
"C_Cpp.updateChannel": "Insiders",
"lit-html.tags": [
"html",
"raw",
"css"
]
}
It looks like here's a good place to start looking, or apply a quick and dirty fix, but there could be any number of code paths which call that function that need investigating to fix it properly.
➜ ~ grep -Rn '\.mightChangeDocument' .vscode/extensions/vscodevim.vim-1.13.0/out/ | grep -v 'mightChangeDocument = '
.vscode/extensions/vscodevim.vim-1.13.0/out//src/mode/modeHandler.js:481: ? recordedState.operator.mightChangeDocument
.vscode/extensions/vscodevim.vim-1.13.0/out//src/mode/modeHandler.js:482: : action.mightChangeDocument;
➜ ~
@J-Fields I was able to reproduce with this:
"vim.normalModeKeyBindings": [
{
"before": [
"c"
],
"after": [
"\"",
"_",
"c"
]
}.
If I do cw and try to move with the arrow keys I get the error.
Thanks all. @cvaldev that works for me as well, I'll try to track this down when I get the chance