Skip to content
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

Support multiple targets per scope #1509

Merged
merged 1 commit into from
Jun 6, 2023

Conversation

pokey
Copy link
Member

@pokey pokey commented May 28, 2023

Checklist

@pokey pokey force-pushed the pokey/support-child-range-predicate branch from 84f562b to d88ec85 Compare May 28, 2023 13:51
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from 84aeab2 to 04cf9b8 Compare May 28, 2023 13:51
@pokey pokey force-pushed the pokey/support-child-range-predicate branch from d88ec85 to 809c4ed Compare May 28, 2023 14:01
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from 04cf9b8 to 65a080a Compare May 28, 2023 14:01
@pokey pokey force-pushed the pokey/support-child-range-predicate branch from 809c4ed to de7311a Compare May 28, 2023 14:07
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from 65a080a to 538f8b7 Compare May 28, 2023 14:07
@pokey pokey force-pushed the pokey/support-child-range-predicate branch from de7311a to db10418 Compare May 28, 2023 14:23
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from 538f8b7 to 980ad18 Compare May 28, 2023 14:23
Comment on lines +28 to +30
if (targets1.length !== 1 || targets2.length !== 1) {
throw Error("Scope range targets must be single-target");
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't sure what to do in this case. seems like a corner case that will never happen. But basically it's if user says "take tags air past bat", which doesn't really make any sense

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the punchline. We merge tree-sitter scopes with the same domain. See #1507 for a change that requires developer to specifically tag these captures with #allow-multiple!

@@ -89,7 +89,7 @@ function processSurroundingPairCore(
return findSurroundingPairTextBased(
editor,
range,
containingScope.contentRange,
containingScope[0].contentRange,
Copy link
Member Author

@pokey pokey May 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't sure what to do here, but I don't think it matters too much: it's for legacy surrounding pair modifier, and would be the situation where there are is a text fragment capture that has multiple targets, which I can't really see being a case we'll need to support. In #1507 we actually throw an error if they try to use #allow-multiple! for a text fragment

@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch 2 times, most recently from 23fcbff to 7f02822 Compare May 28, 2023 14:40
@pokey pokey force-pushed the pokey/support-child-range-predicate branch from db10418 to 62d4370 Compare May 28, 2023 14:40
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from 7f02822 to da0805c Compare May 28, 2023 14:44
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from da0805c to df5c834 Compare May 30, 2023 01:17
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from df5c834 to c6e6679 Compare May 30, 2023 14:53
@pokey pokey force-pushed the pokey/support-child-range-predicate branch 2 times, most recently from 1843991 to efaf773 Compare May 31, 2023 19:43
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from c6e6679 to 1f71bf0 Compare May 31, 2023 19:43
@pokey pokey force-pushed the pokey/support-child-range-predicate branch from efaf773 to 98daf2c Compare June 1, 2023 18:46
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch 3 times, most recently from fbc0e27 to 8734be6 Compare June 1, 2023 21:05
@pokey pokey force-pushed the pokey/support-child-range-predicate branch from a2159f7 to 3b1cfff Compare June 1, 2023 21:05
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from 8734be6 to 726f7c2 Compare June 4, 2023 00:05
@pokey pokey force-pushed the pokey/support-child-range-predicate branch from 3b1cfff to 0edf161 Compare June 4, 2023 00:05
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from 726f7c2 to ba21794 Compare June 5, 2023 10:49
Base automatically changed from pokey/support-child-range-predicate to main June 5, 2023 23:17
@pokey pokey force-pushed the pokey/support-multiple-targets-per-scope branch from ba21794 to c64f7b4 Compare June 6, 2023 10:41
@pokey pokey marked this pull request as ready for review June 6, 2023 10:42
@pokey pokey enabled auto-merge June 6, 2023 10:42
@pokey pokey added this pull request to the merge queue Jun 6, 2023
Merged via the queue into main with commit 0b7756e Jun 6, 2023
@pokey pokey deleted the pokey/support-multiple-targets-per-scope branch June 6, 2023 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants