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

highlighting: Gate multiple captures behind #is-not? local predicates #9390

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

the-mikedavis
Copy link
Member

Fixes gleam-lang/tree-sitter-gleam#81

This is a part of tree-sitter/tree-sitter#1602 - I forgot to make this change to Helix after making it to tree-sitter-cli. If you have a pattern that has multiple captures and uses the #is-not? local predicate:

; runtime/queries/gleam/highlights.scm
((field_access
  record: (identifier) @namespace
  field: (label) @function)
 (#is-not? local))

the entire pattern should not apply if the @namespace (i.e. the first) capture is not defined locally. To do that we need to remove the match so that the captures iterator doesn't return the remaining captures from the match in the future.

@the-mikedavis the-mikedavis added C-bug Category: This is a bug E-easy Call for participation: Experience needed to fix: Easy / not much A-tree-sitter Area: Tree-sitter S-waiting-on-review Status: Awaiting review from a maintainer. labels Jan 20, 2024
@archseer archseer merged commit cda8ea9 into master Jan 25, 2024
6 checks passed
@archseer archseer deleted the tree-sitter-is-not-local-multiple-captures branch January 25, 2024 05:10
flinesse pushed a commit to flinesse/helix that referenced this pull request Jan 25, 2024
flinesse pushed a commit to flinesse/helix that referenced this pull request Jan 25, 2024
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
postsolar pushed a commit to postsolar/helix that referenced this pull request Apr 4, 2024
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tree-sitter Area: Tree-sitter C-bug Category: This is a bug E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two dots in guard clause cause syntax highlighting issue in Helix
2 participants