Skip to content

Commit 79c3358

Browse files
Made jsx attributes be referable as item (#1601)
Fixes #912 ## 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
1 parent 34d128f commit 79c3358

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

packages/cursorless-engine/src/languages/typescript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ const nodeMatchers: Partial<
161161
map: mapTypes,
162162
list: listTypes,
163163
string: ["string", "template_string"],
164+
collectionItem: "jsx_attribute",
164165
collectionKey: trailingMatcher(
165166
[
166167
"pair[key]",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
languageId: javascriptreact
2+
command:
3+
version: 5
4+
spokenForm: clear every item
5+
action: {name: clearAndSetSelection}
6+
targets:
7+
- type: primitive
8+
modifiers:
9+
- type: everyScope
10+
scopeType: {type: collectionItem}
11+
usePrePhraseSnapshot: true
12+
initialState:
13+
documentContents: <Button data-testid="Action Button" data-variant="bare"></Button>
14+
selections:
15+
- anchor: {line: 0, character: 8}
16+
active: {line: 0, character: 8}
17+
marks: {}
18+
finalState:
19+
documentContents: <Button ></Button>
20+
selections:
21+
- anchor: {line: 0, character: 8}
22+
active: {line: 0, character: 8}
23+
- anchor: {line: 0, character: 9}
24+
active: {line: 0, character: 9}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
languageId: javascriptreact
2+
command:
3+
version: 5
4+
spokenForm: clear item
5+
action: {name: clearAndSetSelection}
6+
targets:
7+
- type: primitive
8+
modifiers:
9+
- type: containingScope
10+
scopeType: {type: collectionItem}
11+
usePrePhraseSnapshot: true
12+
initialState:
13+
documentContents: <Button data-testid="Action Button" data-variant="bare"></Button>
14+
selections:
15+
- anchor: {line: 0, character: 8}
16+
active: {line: 0, character: 8}
17+
marks: {}
18+
finalState:
19+
documentContents: <Button data-variant="bare"></Button>
20+
selections:
21+
- anchor: {line: 0, character: 8}
22+
active: {line: 0, character: 8}

0 commit comments

Comments
 (0)