Repository navigation
highlighter: Add a QueryMatchIter type - #39
Merged
Merged
Conversation
|
this looks good, is there anything i should do / do you want me to close my other prs? |
Member
Author
|
I'll swing through the PRs and close them out once this is all merged down, I just wanted to mention what I was thinking for this problem. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a new iterator type, very similar to
QueryIter, calledQueryMatchIter. There's a new trait covering the peeking strategy so that we can share the layer management code between the two.QueryIteris an iterator across injection layers of captures while the newQueryMatchIterreturns entire matches. Tree-sitter supports iterating on either - we needed some extra work in the highlighter crate here to expose that same choice across injection layers.This is more useful for some tree-sitter use-cases. Specifically what I have in mind is for
tags.scmqueries we want to associate the@namecapture in a match with the@definition.*capture. A query match does that automatically for us, while with query captures we'd need to maintain extra state tracking the captures in a match.Also see helix-editor/helix#14853, #29, cc @m4rch3n1ng. A sample usage of this is in helix-editor/helix@cefee4e.