diff --git a/Cargo.lock b/Cargo.lock index 5cbd2899d..a8ba3a104 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2800,9 +2800,9 @@ checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" [[package]] name = "tree-house" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "803311306ba3279e87699f7fa16ea18fbcc8889d0ff0c20dc0652317f8b58117" +checksum = "679e3296e503901cd9f6e116be5a43a9270222215bf6c78b4b1f4af5c3dcc62d" dependencies = [ "arc-swap", "hashbrown 0.15.3", @@ -2817,9 +2817,9 @@ dependencies = [ [[package]] name = "tree-house-bindings" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bec701469c18312edc48d0a29e29987d0359c8b1fff1e1f718da5815b9f5b0e" +checksum = "690809022f44e3d2329882649724b6e0027ade3fada65e4631d303e744dc32b4" dependencies = [ "cc", "libloading", diff --git a/Cargo.toml b/Cargo.toml index 1daf1b03c..ab399829c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ package.helix-tui.opt-level = 2 package.helix-term.opt-level = 2 [workspace.dependencies] -tree-house = { version = "0.1.0", default-features = false } +tree-house = { version = "0.2.0", default-features = false } nucleo = "0.5.0" slotmap = "1.0.7" thiserror = "2.0" diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index befbb06f5..c9415d1d5 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -1,6 +1,7 @@ use std::{borrow::Cow, collections::HashMap, iter}; use helix_stdx::rope::RopeSliceExt; +use tree_house::TREE_SITTER_MATCH_LIMIT; use crate::{ chars::{char_is_line_ending, char_is_whitespace}, @@ -629,9 +630,7 @@ fn query_indents<'a>( let mut indent_captures: HashMap> = HashMap::new(); let mut extend_captures: HashMap> = HashMap::new(); - let mut cursor = InactiveQueryCursor::new(); - cursor.set_byte_range(range); - let mut cursor = cursor.execute_query( + let mut cursor = InactiveQueryCursor::new(range, TREE_SITTER_MATCH_LIMIT).execute_query( &query.query, &syntax.tree().root_node(), RopeInput::new(text), diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index ac689eb38..8fa185c6f 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -864,12 +864,8 @@ impl TextObjectQuery { .iter() .find_map(|cap| self.query.get_capture(cap))?; - let mut cursor = InactiveQueryCursor::new(); - // TODO: this line can be dropped when we update tree-house to automatically reset cursors - // back to defaults when reusing them from the cursor cache. - cursor.set_byte_range(0..u32::MAX); - cursor.set_match_limit(TREE_SITTER_MATCH_LIMIT); - let mut cursor = cursor.execute_query(&self.query, node, RopeInput::new(slice)); + let mut cursor = InactiveQueryCursor::new(0..u32::MAX, TREE_SITTER_MATCH_LIMIT) + .execute_query(&self.query, node, RopeInput::new(slice)); let capture_node = iter::from_fn(move || { let (mat, _) = cursor.next_matched_node()?; Some(mat.nodes_for_capture(capture).cloned().collect())