Skip to content

Add tree-sitter related node support #1430

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

Merged
merged 8 commits into from
Apr 19, 2023

Conversation

pokey
Copy link
Member

@pokey pokey commented Apr 18, 2023

  • Adds @_.domain, @_.leading, @_.trailing, @_.removal, and @_.interior tree-sitter query captures
  • Introduces @_.iteration tree-sitter query capture to allow indicating iteration scope for tree-sitter scope handlers
  • Depends on Introduce tree-sitter queries for syntactic scopes #629

Checklist

@pokey pokey changed the base branch from bases/pokey/add-support-for-domain-leading-trailing-interior to pokey/add-support-for-domain-leading-trailing-interior April 18, 2023 18:30
@pokey pokey force-pushed the pokey/add-support-for-domain-leading-trailing-interior branch from 4ff3022 to 06f3c99 Compare April 18, 2023 18:30
@pokey pokey force-pushed the pokey/tree-sitter-iteration-scope-handlers branch from 18a473b to 5e5562b Compare April 18, 2023 19:14
@pokey pokey changed the base branch from pokey/add-support-for-domain-leading-trailing-interior to main April 18, 2023 19:15
* @param ancestorIndex How many ancestors to go up. 0 means the immediate containing scope
* @returns A target representing the containing scope, or undefined if no containing scope found
*/
export function getContainingScopeTarget(
Copy link
Member Author

Choose a reason for hiding this comment

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

Factored out the core implementation of ContainingScopeStage so that EveryScopeStage could use it directly for expanding to containing iteration scope, because iteration scopes don't necessarily have a well-defined scope type, so it's easier if it can just pass in a scope handler rather than making a dummy scope type just for this purpose

@pokey pokey changed the base branch from main to pokey/add-support-for-domain-leading-trailing-interior April 18, 2023 19:22
Copy link
Member Author

Choose a reason for hiding this comment

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

the way this scope handler defines its iteration scopes got a bit more complex because its constituent scopes could use a custom iteration scope handler

Comment on lines +59 to +60
case "custom":
return scopeType.scopeHandler;
Copy link
Member Author

Choose a reason for hiding this comment

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

For convenience, you can pass in a custom scope type. It's just as easy for the caller to grab the scope handler themselves, but the uniformity of just calling scopeHandlerFactory.create can make their life easier

@pokey pokey requested a review from AndreasArvidsson April 18, 2023 19:31
@pokey pokey changed the title Add tree-sitter iteration scope handlers Add tree-sitter related node support Apr 18, 2023
@pokey pokey changed the base branch from pokey/add-support-for-domain-leading-trailing-interior to bases/pokey/add-support-for-domain-leading-trailing-interior April 18, 2023 19:49
@pokey pokey changed the base branch from bases/pokey/add-support-for-domain-leading-trailing-interior to main April 18, 2023 19:50
@pokey pokey changed the base branch from main to bases/pokey/add-support-for-domain-leading-trailing-interior April 18, 2023 19:50
@pokey pokey force-pushed the pokey/tree-sitter-iteration-scope-handlers branch from 5e5562b to 33c09ec Compare April 18, 2023 22:47
@pokey pokey marked this pull request as ready for review April 19, 2023 10:39
@pokey pokey force-pushed the pokey/tree-sitter-iteration-scope-handlers branch from 33c09ec to d106ab4 Compare April 19, 2023 11:12
@pokey pokey changed the base branch from bases/pokey/add-support-for-domain-leading-trailing-interior to main April 19, 2023 11:13
@pokey pokey enabled auto-merge April 19, 2023 11:13
@pokey pokey added this pull request to the merge queue Apr 19, 2023
Merged via the queue into main with commit d439ec0 Apr 19, 2023
@pokey pokey deleted the pokey/tree-sitter-iteration-scope-handlers branch April 19, 2023 11:48
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.

1 participant