Skip to content

Commit 7e3cb8d

Browse files
committed
Extract TSQuery::from_query()
1 parent 9016fb5 commit 7e3cb8d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/ark/src/treesitter.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,12 @@ impl TSQuery {
651651
let query = tree_sitter::Query::new(language, query_str)
652652
.map_err(|err| anyhow!("Failed to compile query: {err}"))?;
653653

654-
let cursor = tree_sitter::QueryCursor::new();
654+
Ok(Self::from_query(query))
655+
}
655656

656-
Ok(Self { query, cursor })
657+
pub(crate) fn from_query(query: tree_sitter::Query) -> Self {
658+
let cursor = tree_sitter::QueryCursor::new();
659+
Self { query, cursor }
657660
}
658661

659662
/// Match query against `contents` and collect all nodes captured with the

0 commit comments

Comments
 (0)