Crash when mixing `key` / `keys` and using `whichkey.sortOrder`
Bug description
With the config below (note the accidental mixture of key and keys), depending on the exact config (?),
- either "Activating extension 'VSpaceCode.vspacecode' failed: Cannot read properties of undefined (reading 'localeCompare')" gets shown
- or (with this minimal example rather than my real config, it seems?), VS Code seems to freeze entirely.
To Reproduce
- Start VS Code with a clean
--user-data-dir - Copy the snippet below to your config
- Trigger the VSpaceCode menu
Expected behavior
Not quite sure. Probably VSpaceCode should detect that this config is invalid and complain somehow?
Additional context
With my real config:
notificationsAlerts.ts:40 TypeError: Cannot read properties of undefined (reading 'localeCompare')
at u (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:1208)
at l (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:1312)
at Array.sort (<anonymous>)
at g (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:22724)
at g (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:22749)
at g (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:22749)
at g (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:22749)
at g (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:22749)
at _ (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:24345)
at t.default.register (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:24550)
at t.WhichKeyRegistry.register (/home/florian/.vscode/extensions/vspacecode.whichkey-0.11.3/dist/extension-node.js:1:26336)
at o._executeContributedCommand (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:31333)
at o._doExecuteCommand (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:30153)
at o.executeCommand (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:30059)
at Object.executeCommand (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:97:31789)
at /home/florian/.vscode/extensions/vspacecode.vspacecode-0.10.9/dist/extension-node.js:1:49117
at e.activate (/home/florian/.vscode/extensions/vspacecode.vspacecode-0.10.9/dist/extension-node.js:1:49224)
at Function._callActivateOptional (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:17454)
at Function._callActivate (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:17119)
at /opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:14937
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at _activate (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:8180)
at _waitForDepsThenActivate (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:8122)
at _initialize (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:7486)
Keybindings
None.
Settings
Click to toggle contents of `settings.json`
{
"whichkey.sortOrder": "nonNumberFirst",
"vspacecode.bindingOverrides": [
{
"keys": ["x"],
"name": "+Tox",
"icon": "play",
"type": "bindings",
"bindings": [
{
"key": "a",
"name": "Run tox",
"icon": "play",
"type": "command",
"command": "python-tox.select"
},
{
"keys": "t",
"name": "Run tox",
"icon": "play",
"type": "command",
"command": "python-tox.select"
},
]
},
]
}
System information

List of enabled extensions is too long to screenshot (as the --user-data-dir override ignores the extensions I actually have disabled in my main instance), but I doubt it's relevant really. VSpaceCode v0.10.9 and which-key v0.11.3.
I thought about validation a while back. I tried using some sort of json validator. It increase both the size of the extension, and the runtime.
I agree that this is not that good of an experience. However, this is probably is lower priority on the todo list for now 😅
There was this old thread that I dig up https://github.com/VSpaceCode/vscode-which-key/issues/7