replace treesitter #start-position with .startof#1682
replace treesitter #start-position with .startof#1682pokey merged 2 commits intocursorless-dev:mainfrom
Conversation
|
The code of the end of the test is 😬 . Looking forward to knowing the right way to do it. And anything else. :) Be brutal. |
08df141 to
a20f7d2
Compare
|
I guess alternative approach would be to make the rewrite a method on MutableQueryCapture, and in line the forEach loop that calls it. Then the test would mostly go away. :) |
pokey
left a comment
There was a problem hiding this comment.
mostly looks fine, with some minor comments. still slightly on the fence here but seems you and @AndreasArvidsson are leaning towards it so I'll defer because I don't feel too strongly. I do wonder if we want to use startPosition rather than startOf. But again I'll defer to you and @AndreasArvidsson as I don't feel too strongly bout that either
packages/cursorless-engine/src/languages/TreeSitterQuery/TreeSitterQuery.ts
Outdated
Show resolved
Hide resolved
packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.test.ts
Outdated
Show resolved
Hide resolved
packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.test.ts
Outdated
Show resolved
Hide resolved
packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.test.ts
Show resolved
Hide resolved
packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.ts
Outdated
Show resolved
Hide resolved
|
I think this is an improvement. I agree with all pokeys comments. |
|
But @AndreasArvidsson you're leaning towards |
Yes I think so |
a20f7d2 to
2637ec3
Compare
|
thanks! Please take another look. |
This particular query pattern is going to be very common. It's worth having syntactic sugar for. In particular, this reduces the level of indentation required to express that a node's associated scope (iteration, trailing, leading, etc.) should start or end at the start or end of a different node. While we're here, make a related error message more helpful.
2637ec3 to
7ae1bae
Compare
pokey
left a comment
There was a problem hiding this comment.
Left one tweak to make jsdoc clearer, but otherwise looks good!
packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.ts
Outdated
Show resolved
Hide resolved
…teStartOfEndOf.ts
This particular query pattern is going to be very common.
It's worth having syntactic sugar for.
In particular, this reduces the level of indentation
required to express that a node's associated scope
(iteration, trailing, leading, etc.)
should start or end at the start or end of a different node.
While we're here, make a related error message more helpful.
Checklist