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

Add support for "e.key" keybindings in extension's contributes.keybindings #3671

Closed
aioutecism opened this issue Mar 3, 2016 · 8 comments
Closed
Labels
api feature-request Request for new features or functionality keybindings VS Code keybinding issues keyboard-layout Keyboard layout issues
Milestone

Comments

@aioutecism
Copy link
Contributor

I'm encountering this problem when dealing with different keyboard layout in extension.

Say I have these in my extension's package.json:

{
  "contributes": {
    "keybindings": [
      {
        "key": "\\",
        "command": "myExtension.backSlash"
      }
    ]
  }
}

I'm trying to map \ here.
However, what VSCode actually does is map VK_OEM_5 to myExtension.backSlash.
Therefore, I get \ => myExtension.backSlash on US keyboard (which is correct) but # => myExtension.backSlash on British keyboard (which is wrong), which is not correct.

I've done a workaround to deal with different keyboard layouts here.
But users have to add a setting in configuration in order to tell the extension the layout they are using.
This is troublesome and extension shouldn't do all the handling of keyboard layout.

@aioutecism aioutecism changed the title Ability to bind true key in extension's contributes.keybindings Ability to bind real key in extension's contributes.keybindings Mar 3, 2016
@aioutecism
Copy link
Contributor Author

Also, the dead key problem will be solved too if "real key" binding is possible.

@erikbra
Copy link

erikbra commented Mar 4, 2016

aioutecism/amVim-for-VSCode#46 (I didn't manage to test it - low skills developing Code plugins :))

@aioutecism
Copy link
Contributor Author

Thank you @erikbra!
I leaved some comments #46.

@alexdima alexdima added this to the March 2016 milestone Mar 17, 2016
@alexdima
Copy link
Member

https://github.com/alexandrudima/vscode-vim shows how to better handle keyboard input in the case of a vim extension

@aioutecism
Copy link
Contributor Author

Well, yes, listening to type event can solve the layout problem of vim extension.
But, if an extension want to add custom function when cmd+\ is pressed, we still need to deal with different keyboard layout since cmd+\ is not passed to type.
Having type event gives developers a workaround for some problem. But doesn't solve the problem that keybinding settings is not binding the "real" key.

@alexdima
Copy link
Member

Unfortunately, all the commands of vscode itself have the same limitation. This is not a limitation we have added, it was a design choice done by w3c when they drafted the keydown event specification.

We can revisit this once Chromium decides to implement KeyboardEvent.key in a correct way, so it is ok with me to keep this open as a tracking issue.

@alexdima alexdima reopened this Mar 17, 2016
@alexdima alexdima added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Mar 17, 2016
@aioutecism
Copy link
Contributor Author

Thanks! Looking forward to the fix.

@egamma egamma modified the milestones: Backlog, March 2016 Mar 17, 2016
@alexdima alexdima added the keyboard-layout Keyboard layout issues label Mar 24, 2017
@alexdima alexdima changed the title Ability to bind real key in extension's contributes.keybindings Add support for "e.key" keybindings in extension's contributes.keybindings Mar 24, 2017
@alexdima alexdima added feature-request Request for new features or functionality api and removed upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Mar 24, 2017
@alexdima alexdima removed their assignment Mar 24, 2017
@alexdima
Copy link
Member

This is now done via #130396 , where extensions can contribute scan code based keybindings. the full list of scan codes.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality keybindings VS Code keybinding issues keyboard-layout Keyboard layout issues
Projects
None yet
Development

No branches or pull requests

5 participants