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

Support parenthesis in when clause in wrapper keybindings generator #296

Closed
tshino opened this issue Sep 23, 2023 · 1 comment
Closed

Support parenthesis in when clause in wrapper keybindings generator #296

tshino opened this issue Sep 23, 2023 · 1 comment

Comments

@tshino
Copy link
Owner

tshino commented Sep 23, 2023

I've found that parenthesis support has been introduced as part of the when clause context from VS Code 1.77.
microsoft/vscode#175540

If parentheses are used in the default keybindings or any keymap extensions that we support, this extension will require changes to support them in wrapper generator scripts described in below:
https://github.com/tshino/vscode-kb-macro/blob/main/DESIGN.md#default-keybindings-wrappers

This extension defines a large set of keybindings to capture all the default keyboard shortcuts of VS Code.

The list of default keybindings wrappers is defined in the package.json of this extension. The list is automatically generated by a script generator/gen_wrapper.js. The script takes three keybindings JSON files where each one containing the default keybindings of VS Code for Windows, Linux, and macOS respectively, and combines all the keybindings in them with additional context such as isWindows, isLinux, or isMac as needed, and convert them to wrappers and write them into keybindings section of the package.json.

In order to generate the wrapper keybindings, it is needed to tweak the every when context. And in the test, we need to analyze them to verify that the result should work. And those functionalities have been implemented based on the good old when clause which was much simpler to be parsed than now. So now we should do some additional work to support the new grammar in the scripts.

At least following functions should be investigated:

  • addWhenContext(when, context) in gen_wrapper_util.js
  • negateContext(context) in gen_wrapper_util.js
  • containsWhenContext(when, context) in verify_wrapper.js
  • removeWhenContext(when, context) in verify_wrapper.js
  • joinComplementalKeybindings(keybindings) in verify_wrapper.js

A keymap extension that is possibly about to introduce parentheses: (Thankfully, this made me aware of the issue. 😂)

tshino added a commit that referenced this issue Oct 15, 2023
tshino added a commit that referenced this issue Oct 19, 2023
tshino added a commit that referenced this issue Oct 20, 2023
tshino added a commit that referenced this issue Oct 21, 2023
tshino added a commit that referenced this issue Oct 22, 2023
tshino added a commit that referenced this issue Dec 10, 2023
tshino added a commit that referenced this issue Dec 12, 2023
tshino added a commit that referenced this issue Dec 26, 2023
@tshino
Copy link
Owner Author

tshino commented Dec 26, 2023

Done!

@tshino tshino closed this as completed Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant