Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when mixing key / keys and using whichkey.sortOrder #68

Open
The-Compiler opened this issue Jun 23, 2022 · 2 comments
Open

Crash when mixing key / keys and using whichkey.sortOrder #68

The-Compiler opened this issue Jun 23, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@The-Compiler
Copy link
Contributor

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

image

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.

@The-Compiler The-Compiler added the bug Something isn't working label Jun 23, 2022
@stevenguh
Copy link
Member

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 😅

@stevenguh
Copy link
Member

There was this old thread that I dig up #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants