From a9ebec374cf10b3277fad82f96624976248cfd03 Mon Sep 17 00:00:00 2001 From: tshino Date: Sun, 28 Nov 2021 15:32:48 +0900 Subject: [PATCH] Update DESIGN.md --- DESIGN.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 633cdd12..94984606 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -26,18 +26,26 @@ So we end up defining a bunch of wrapper keybindings to capture the whole set of A wrapper keybinding associates a particular combination of `key` and `when` with the `kb-macro.wrap` command with `args` parameter that specifies the target command to be invoked. The `kb-macro.wrap` command executes the target command. This indirect execution makes it possible to capture the command that has been triggered by user's keystrokes. -We use the wrapper command only when the macro recording is ongoing. So we add the `kb-macro.recording` context to the wrapper keybindings. +We use the wrapper command only when the macro recording is ongoing. So we add the `kb-macro.recording` context to every wrapper keybinding. Why don't we use the wrapper keybindings always to simplify things? Because we want to keep the original behavior of each command for the keybindings as much as possible. It is not clear but the indirect execution may not be perfectly transparent. ## Default wrapper keybindings -This extension defines a large set of keybindins to capture all the default keyboard shortcuts of VS Code. +This extension defines a large set of keybindings to capture all the default keyboard shortcuts of VS Code. -The list of default wrapper keybindings is defined in the `package.json` of this extension. The list is automatically generated by a script `generator/gen-wrapper.js`. The script takes JSON files that contain the default keybindings of VS Code for Windows, Linux, and macOS, 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`. +The list of default wrapper keybindings is defined in the `package.json` of this extension. The list is automatically generated by a script `generator/gen_wrapper.js`. The script takes JSON files where each one contains 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`. The script also performs some optimization work to reduce the amount of wrapper keybinding rules. +| Related files | | +| ------------- | --- | +| `generator/default-keybindings-win.json` | the default keybindings of VS Code for Windows | +| `generator/default-keybindings-linux.json` | the default keybindings of VS Code for Linux | +| `generator/default-keybindings-mac.json` | the default keybindings of VS Code for macOS | +| `generator/gen_wrapperjs` | a script to generate default wrapper keybindings and write them in `package.json` | +| `generator/verify_wrapperjs` | a script to verify the output of `gen_wrapper.js` | + ## Capturing typed characters On VS Code, typed characters in text editors are treated differently than other keystrokes. We don't put every possible character in the keybindings. When you type characters in a text editor, for each character, the `type` build-in command is invoked internally. The `type` command performs inserting each character into the document.