Update tree-house and bindings to v0.2.0

pull/13703/head
Michael Davis 2025-06-06 17:14:08 -04:00
parent 637274c4d4
commit 7410fe35a3
No known key found for this signature in database
4 changed files with 9 additions and 14 deletions

8
Cargo.lock generated
View File

@ -2800,9 +2800,9 @@ checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076"
[[package]] [[package]]
name = "tree-house" name = "tree-house"
version = "0.1.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "803311306ba3279e87699f7fa16ea18fbcc8889d0ff0c20dc0652317f8b58117" checksum = "679e3296e503901cd9f6e116be5a43a9270222215bf6c78b4b1f4af5c3dcc62d"
dependencies = [ dependencies = [
"arc-swap", "arc-swap",
"hashbrown 0.15.3", "hashbrown 0.15.3",
@ -2817,9 +2817,9 @@ dependencies = [
[[package]] [[package]]
name = "tree-house-bindings" name = "tree-house-bindings"
version = "0.1.1" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bec701469c18312edc48d0a29e29987d0359c8b1fff1e1f718da5815b9f5b0e" checksum = "690809022f44e3d2329882649724b6e0027ade3fada65e4631d303e744dc32b4"
dependencies = [ dependencies = [
"cc", "cc",
"libloading", "libloading",

View File

@ -37,7 +37,7 @@ package.helix-tui.opt-level = 2
package.helix-term.opt-level = 2 package.helix-term.opt-level = 2
[workspace.dependencies] [workspace.dependencies]
tree-house = { version = "0.1.0", default-features = false } tree-house = { version = "0.2.0", default-features = false }
nucleo = "0.5.0" nucleo = "0.5.0"
slotmap = "1.0.7" slotmap = "1.0.7"
thiserror = "2.0" thiserror = "2.0"

View File

@ -1,6 +1,7 @@
use std::{borrow::Cow, collections::HashMap, iter}; use std::{borrow::Cow, collections::HashMap, iter};
use helix_stdx::rope::RopeSliceExt; use helix_stdx::rope::RopeSliceExt;
use tree_house::TREE_SITTER_MATCH_LIMIT;
use crate::{ use crate::{
chars::{char_is_line_ending, char_is_whitespace}, chars::{char_is_line_ending, char_is_whitespace},
@ -629,9 +630,7 @@ fn query_indents<'a>(
let mut indent_captures: HashMap<usize, Vec<IndentCapture>> = HashMap::new(); let mut indent_captures: HashMap<usize, Vec<IndentCapture>> = HashMap::new();
let mut extend_captures: HashMap<usize, Vec<ExtendCapture>> = HashMap::new(); let mut extend_captures: HashMap<usize, Vec<ExtendCapture>> = HashMap::new();
let mut cursor = InactiveQueryCursor::new(); let mut cursor = InactiveQueryCursor::new(range, TREE_SITTER_MATCH_LIMIT).execute_query(
cursor.set_byte_range(range);
let mut cursor = cursor.execute_query(
&query.query, &query.query,
&syntax.tree().root_node(), &syntax.tree().root_node(),
RopeInput::new(text), RopeInput::new(text),

View File

@ -864,12 +864,8 @@ impl TextObjectQuery {
.iter() .iter()
.find_map(|cap| self.query.get_capture(cap))?; .find_map(|cap| self.query.get_capture(cap))?;
let mut cursor = InactiveQueryCursor::new(); let mut cursor = InactiveQueryCursor::new(0..u32::MAX, TREE_SITTER_MATCH_LIMIT)
// TODO: this line can be dropped when we update tree-house to automatically reset cursors .execute_query(&self.query, node, RopeInput::new(slice));
// 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 capture_node = iter::from_fn(move || { let capture_node = iter::from_fn(move || {
let (mat, _) = cursor.next_matched_node()?; let (mat, _) = cursor.next_matched_node()?;
Some(mat.nodes_for_capture(capture).cloned().collect()) Some(mat.nodes_for_capture(capture).cloned().collect())