-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Basic keyboard features #2169
Basic keyboard features #2169
Conversation
ce3c1ca
to
6d92345
Compare
2becfef
to
a82b28d
Compare
18e3e3f
to
73cc06b
Compare
17643e6
to
bdab379
Compare
73cc06b
to
8fad1fe
Compare
bdab379
to
e31466b
Compare
8fad1fe
to
9fc74ca
Compare
8c675e3
to
35b1dd7
Compare
35b1dd7
to
a9429d1
Compare
f13d1c6
to
8e65c5e
Compare
ok @josharian I'm happy; have a look at my changes and make sure you are too 😊. The first commit should be a fairly unmolested version of your PR, so might be helpful to focus on the diff of the remaining commits |
@AndreasArvidsson when you get a minute, feel free to hide everything in keyboard dir and approve if you're happy with the remainder. I'll wait for @josharian's approval on the rest before merging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo little nits
@@ -108,6 +108,8 @@ export default class KeyboardCommandsModal { | |||
|
|||
modeOn = async () => { | |||
if (this.isModeOn()) { | |||
// Set target to current selection if we re-run mode on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't follow this comment (can't even quite parse it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While trying to write a better comment, I decided I didn't like the way it was implemented. See https://github.com/cursorless-dev/cursorless/pull/2169/files#diff-9c79f806edb4ea294501b9810d847bd61a9cb17bcfe6930f91ca4cf062a36fc5 for my new solution
packages/cursorless-vscode/src/keyboard/grammar/getAcceptableTokenTypes.ts
Show resolved
Hide resolved
packages/cursorless-vscode/src/keyboard/grammar/grammarHelpers.ts
Outdated
Show resolved
Hide resolved
ok @josharian all good? |
LGTM but s/alread/already/ I assume there’s no VSCode event for when the cursor moves? (Thinking about future automation of keeping the selection in sync.) |
There is, but I'm not sure that's desirable |
Yeah, maybe not. |
The original partial arg code constructed a partial arg where each field of the top-level command arg was either completely filled out or completely missing. Before #2169, that was fine, because the top-level commands were more specific, and thus their args had more detail and the command id itself told you more. For example, in `modifyTargetContainingScopeType`, you had a specific scope type that was missing, but you knew from command id that it was "containing". As of #2169, we do a lot more in the lower level captures. For example `modifyTargetContainingScopeType` and `modifyTargetEveryScopeType` are now just `modifyTarget`, which only has a `modifier` key at the top level, so you don't know until the very end what you're dealing with, because every modifier just looks like `{command: "modifyTarget", partialArg: {modifier: undefined}}`. This PR deeply reconstructs the partial target, so that you can get much more information. See the new test cases for examples of these partial arguments - Depends on #2169 ## Checklist - [x] Switch to `CURRENT` for default arg - [x] Remove unique queue file - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
- Depends on cursorless-dev#2168 ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
The original partial arg code constructed a partial arg where each field of the top-level command arg was either completely filled out or completely missing. Before cursorless-dev#2169, that was fine, because the top-level commands were more specific, and thus their args had more detail and the command id itself told you more. For example, in `modifyTargetContainingScopeType`, you had a specific scope type that was missing, but you knew from command id that it was "containing". As of cursorless-dev#2169, we do a lot more in the lower level captures. For example `modifyTargetContainingScopeType` and `modifyTargetEveryScopeType` are now just `modifyTarget`, which only has a `modifier` key at the top level, so you don't know until the very end what you're dealing with, because every modifier just looks like `{command: "modifyTarget", partialArg: {modifier: undefined}}`. This PR deeply reconstructs the partial target, so that you can get much more information. See the new test cases for examples of these partial arguments - Depends on cursorless-dev#2169 ## Checklist - [x] Switch to `CURRENT` for default arg - [x] Remove unique queue file - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
Checklist