Rebuilt from the exact zed-industries/zed @ 8c74db00c4053d6c0a9037863d7bd048658da4ca tree (previous orphan was based on a stale/wrong fetch). Same 3-file patch: - serial.rs: add SerialKind::KeyboardEnter - client.rs: store wl_keyboard.enter serial; add latest_serial_of() - window.rs: activate() uses keyboard-enter serial (Mutter focus gate) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
28 lines
815 B
Rust
28 lines
815 B
Rust
pub fn count_tree_sitter_errors<'a>(nodes: impl Iterator<Item = tree_sitter::Node<'a>>) -> usize {
|
|
let mut total_count: usize = 0;
|
|
for node in nodes {
|
|
let mut cursor = node.walk();
|
|
'node: loop {
|
|
let current = cursor.node();
|
|
if current.is_error() || current.is_missing() {
|
|
total_count += 1;
|
|
}
|
|
if current.has_error() && cursor.goto_first_child() {
|
|
continue;
|
|
}
|
|
if cursor.goto_next_sibling() {
|
|
continue;
|
|
}
|
|
loop {
|
|
if !cursor.goto_parent() {
|
|
break 'node;
|
|
}
|
|
if cursor.goto_next_sibling() {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
total_count
|
|
}
|