Skip to content

Comments

Add .type constraint to cs#772

Merged
danieltrt merged 4 commits intomasterfrom
cs_extension
Jul 24, 2025
Merged

Add .type constraint to cs#772
danieltrt merged 4 commits intomasterfrom
cs_extension

Conversation

@danieltrt
Copy link
Collaborator

This PR adds a new constraint type to the concrete syntax, letting users restrict the types of nodes they match against. This should lead to significant performance improvements at match time.

  • Added three new E2E tests for the type matchers
  • root is a special keyword for referring to the entire match, so we can constrain not just capture nodes but the full match itself

end_point: crate::models::matches::Point { row: 0, column: 0 },
},
text: String::new(),
node_type: "empty".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps make this more verbose like <empty-node-type-that-should-never-be-matched>?

empty feels too generic and if we see this when debugging we might think it's a valid node type.

@danieltrt danieltrt merged commit 61f1901 into master Jul 24, 2025
6 checks passed
@danieltrt danieltrt deleted the cs_extension branch July 24, 2025 08:14
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