@@ -590,8 +590,7 @@ impl<'a> TreesitterContext<'a> {
590590 // `node.child_by_field_id(..)` does not work as expected
591591 let mut on_node = None ;
592592 for child in node. children ( cursor) {
593- // 28 is the id for "keyword_on"
594- if child. kind_id ( ) == 28 {
593+ if child. kind ( ) == "keyword_on" {
595594 on_node = Some ( child) ;
596595 }
597596 }
@@ -620,7 +619,7 @@ impl<'a> TreesitterContext<'a> {
620619 /// Verifies whether the node_under_cursor has the passed in ancestors in the right order.
621620 /// Note that you need to pass in the ancestors in the order as they would appear in the tree:
622621 ///
623- /// If the tree shows `relation > object_reference > identifier ` and the "identifier " is a leaf node,
622+ /// If the tree shows `relation > object_reference > any_identifier ` and the "any_identifier " is a leaf node,
624623 /// you need to pass `&["relation", "object_reference"]`.
625624 pub fn matches_ancestor_history ( & self , expected_ancestors : & [ & ' static str ] ) -> bool {
626625 self . node_under_cursor . as_ref ( ) . is_some_and ( |node| {
@@ -642,7 +641,7 @@ impl<'a> TreesitterContext<'a> {
642641 /// Verifies whether the node_under_cursor has the passed in ancestors in the right order.
643642 /// Note that you need to pass in the ancestors in the order as they would appear in the tree:
644643 ///
645- /// If the tree shows `relation > object_reference > identifier ` and the "identifier " is a leaf node,
644+ /// If the tree shows `relation > object_reference > any_identifier ` and the "any_identifier " is a leaf node,
646645 /// you need to pass `&["relation", "object_reference"]`.
647646 pub fn matches_one_of_ancestors ( & self , expected_ancestors : & [ & ' static str ] ) -> bool {
648647 self . node_under_cursor . as_ref ( ) . is_some_and ( |node| {
@@ -663,9 +662,9 @@ impl<'a> TreesitterContext<'a> {
663662 /// * keyword_from [9..13] 'from'
664663 /// * relation [14..28] '"auth"."users"'
665664 /// * object_reference [14..28] '"auth"."users"'
666- /// * identifier [14..20] '"auth"'
665+ /// * any_identifier [14..20] '"auth"'
667666 /// * . [20..21] '.'
668- /// * identifier [21..28] '"users"'
667+ /// * any_identifier [21..28] '"users"'
669668 /// */
670669 ///
671670 /// if node_under_cursor_is_nth_child(1) {
@@ -1132,13 +1131,13 @@ mod tests {
11321131 keyword_where [29..34] 'where'
11331132 binary_expression [35..43] 'id = @id'
11341133 field [35..37] 'id'
1135- identifier [35..37] 'id'
1134+ any_identifier [35..37] 'id'
11361135 = [38..39] '='
11371136 field [40..43] '@id'
1138- identifier [40..43] '@id'
1137+ any_identifier [40..43] '@id'
11391138 @ [40..41] '@'
11401139
1141- You can see that the '@' is a child of the "identifier " but has a range smaller than its parent's.
1140+ You can see that the '@' is a child of the "any_identifier " but has a range smaller than its parent's.
11421141 This would crash our context parsing because, at position 42, we weren't at the leaf node but also couldn't
11431142 go to a child on that position.
11441143 */
0 commit comments