Skip to content

Commit

Permalink
Update DESIGN.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tshino committed Jan 27, 2023
1 parent 9278a92 commit a06d8af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Why don't we use the wrapper keybindings always to simplify things? Because we w

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](package.json). The list is automatically generated by a script [`generator/gen_wrapper.js`](generator/gen_wrapper.js). The script takes three keybindings 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 list of default keybindings wrappers is defined in the [`package.json` of this extension](package.json). The list is automatically generated by a script [`generator/gen_wrapper.js`](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`.

| Related files | |
| ------------- | --- |
Expand Down Expand Up @@ -119,7 +119,7 @@ As far as I know, an extension is allowed to override the `type` built-in comman

It was not clear whether overriding the `type` command to capture typed characters is a good way for this extension. Especially if you use this extension combined with another extension that is overriding the `type` command too, there would be a conflict, and likely they will not work correctly. See [vscode#13441](https://github.com/Microsoft/vscode/issues/13441).

So this extension took another way to capture typed characters. That is to listen to the events on changes on the text document. Basically this is possible through the `vscode.workspace.onDidChangeTextDocument` event.
So this extension took another way to capture typed characters. That is to listen to the events on changes on the text document. Basically, this is possible through the `vscode.workspace.onDidChangeTextDocument` event.

This is implemented in [`src/typing_detector.js`](src/typing_detector.js).

Expand Down Expand Up @@ -150,7 +150,7 @@ These command patterns are implemented in [`src/reentrant_guard.js`](src/reentra

## API

This extension provides an experimental API that other extensions could use to realize custom keyboard automation in a different manner than this extension. [Dynamic Macro](https://marketplace.visualstudio.com/items?itemName=tshino.dynamic-macro) is an extension that uses this API. You can find some details and the background information at [#176](https://github.com/tshino/vscode-kb-macro/issues/176).
This extension provides an experimental API that other extensions could use to realize custom keyboard automation in a different manner than this extension. [Dynamic Macro](https://marketplace.visualstudio.com/items?itemName=tshino.dynamic-macro) is an extension that uses this API. You can find some details and background information at [#176](https://github.com/tshino/vscode-kb-macro/issues/176).

## Testing

Expand All @@ -161,7 +161,7 @@ test/
suite/
*.test.js
```
They can be categorized roughly into two types. One is unit tests, and the other is integration tests. A test that has the name `playback_*.test.js` is an integration test, which checks the recording and playback functionality focusing on a certain category of target commands/keybindings or on a functionality of this extension.
They can be categorized roughly into two types. One is unit tests, and the other is integration tests. A test that has the name `playback_*.test.js` is an integration test, which checks the recording and playback functionality focusing on a certain category of target commands/keybindings or on a particular functionality of this extension.

The following command runs the tests:
```
Expand All @@ -171,7 +171,7 @@ And it's [running on GitHub Actions](https://github.com/tshino/vscode-kb-macro/a

### End-to-end tests

Unfortunately, we don't have any end-to-end tests which are critical for this kind of extension. Because we use [`vscode-test`](https://github.com/microsoft/vscode-test) and it doesn't provide UI level testing functionalities such as sending keystrokes to VS Code.
Unfortunately, we don't have any end-to-end tests which are critical for this kind of extension. Because we use [`vscode-test`](https://github.com/microsoft/vscode-test) and it doesn't provide UI-level testing functionalities such as sending keystrokes to VS Code.

The lack of end-to-end tests means we can't test the validity of the keybindings defined in the `package.json` through the test based on `vscode-test`.

Expand Down

0 comments on commit a06d8af

Please sign in to comment.