fix(query): correctly identify MISSING nodes in queries

This commit is contained in:
Will Lillis 2026-08-09 12:13:08 -05:00
parent 1b916ab754
commit 5fae914f8f
2 changed files with 11 additions and 1 deletions

View file

@ -416,6 +416,16 @@ fn test_query_errors_on_invalid_symbols() {
message: "\"fakefield\"".to_string()
}
);
assert_eq!(
Query::new(&language, "(MISS)").unwrap_err(),
QueryError {
row: 0,
offset: 1,
column: 1,
kind: QueryErrorKind::NodeType,
message: "\"MISS\"".to_string(),
}
);
});
}

View file

@ -2551,7 +2551,7 @@ static TSQueryError ts_query__parse_pattern(
// Parse the wildcard symbol
if (length == 1 && node_name[0] == '_') {
symbol = WILDCARD_SYMBOL;
} else if (!strncmp(node_name, "MISSING", length)) {
} else if (length == 7 && !strncmp(node_name, "MISSING", length)) {
is_missing = true;
stream_skip_whitespace(stream);