cursorless
cursorless copied to clipboard
`touch item sun` inside jsx selects whole tag instead of attribute
Using this code <Button data-testid="Action Button" data-variant="bare">
Say touch key air
Selects
data-testid
as expected.
Say touch value air
Also works as expected
Say touch item air
Selects the whole contents of the JSX not
data-testid="Action Button"
You can use "attribute" for that, although I can see how you'd expect "item" to work there, given we support it for key-value pairs elsewhere. Hmm. @AndreasArvidsson WDYT?
Ahh, yes that works thanks. Didn't know about attribute
Yeah it would probably be good if item worked here
I definitely didn't expect item
to select everything between <>
Yeah agreed that's unintuitive. Fwiw the reason it does that is that "item" is just a text-based matcher that selects items in a comma-separated list surrounded by matching pairs. So in this case it saw the code as a single-element list between angle brackets 😄
I'm unable to verify that this is fixed with Cursorless v0.26.740 and Parse tree v0.26.4.
Using the following source:
https://github.com/cursorless-dev/cursorless/blob/34d128fe33880991043cbeeeb3f23c689a721314/packages/cursorless-org/src/pages/cheatsheet.tsx#L19
highlight item
(I'm using the keyboard interface):
highlight attribute
still works as expected: