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

Feature: Shift Shift, Ctrl Ctrl, Alt Alt Keybinds (Double press modifer keybind support) #115190

Merged
merged 20 commits into from
Feb 2, 2021

Conversation

PathToLife
Copy link
Contributor

@PathToLife PathToLife commented Jan 27, 2021

This PR fixes #5280 How to detect shift shift key in VSCode?

Proposed changes:

Implemented support for quick double presses of a modifier key without unit test regressions or noticeable performance hits, while following existing architecture as closely as possible.

This implementation improves UX experience for users migrating from JetBrains platform

Keybindings.json

    {
        "key": "shift shift",
        "command": "workbench.action.quickOpen"
    },
    {
        "key": "ctrl ctrl",
        "command": "workbench.action.showCommands"
    },
    {
        "key": "alt alt",
        "command": "workbench.action.quickOpen"
    },
  • Implemented new keyboard event that checks for keyUp (critical for double press detection, second key MUST be released)
  • Implemented additional keyup resolver for only modifiers, this will allow backwards compatibility with existing keybind system which uses keydown
  • MacLinuxKeyboardMapper getDispatchString() had logic in places inconsistent with windowsKeyboardMapper, fixed

How to test:

  • Run all unit tests, should all pass
  • Test the above Keybindings.json
  • Single modifier press should not activate chord (check notification bar bottom left no changes)
  • Shift+Alphanumeric should work as usual
  • Shift, Shift+Alphanumeric should work as usual no matter how quickly Shift, Shift is pressed (because of keyUp only detection)

Performance Test:

  • Hold backspace on a large string; should be no lag
  • Type fast; should be no lag

image

I'm finding my self pressing "Shift Shift" in VSCode release when cross referencing code for this PR 😂😂😂🤦‍♂️

@ghost
Copy link

ghost commented Jan 27, 2021

CLA assistant check
All CLA requirements met.

[build/lib/layersChecker.ts]: Reference to 'NodeJS' from '@types/node' violates layer '**/vs/**/common/**' (/home/runner/work/vscode/vscode/src/vs/platform/keybinding/common/abstractKeybindingService.ts (39,53)
[build/lib/layersChecker.ts]: Reference to 'Timeout' from '@types/node' violates layer '**/vs/**/common/**' (/home/runner/work/vscode/vscode/src/vs/platform/keybinding/common/abstractKeybindingService.ts (39,60)
@alexdima alexdima added this to the February 2021 milestone Jan 27, 2021
PathToLife and others added 8 commits January 28, 2021 03:06
- fix comment inconsistency
- rename function camelCase
- fix macos not working because scan code was removed
- add isModifierKey() logic to scanCode.ts, consistent with windows keyCodes.ts
@alexdima
Copy link
Member

alexdima commented Feb 2, 2021

Thank you!

@alexdima alexdima merged commit fd978d6 into microsoft:master Feb 2, 2021
@andersonpem
Copy link

Wow! Finally! Thanks guys!

@istvandesign
Copy link

This is life changing! VSCode will be 10x better now ❤🥳 Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to detect shift shift key in VSCode?
4 participants