Bump Tree-sitter

Pass ranges to `set_byte_range`, `set_point_range`

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-05-28 14:25:30 -07:00
parent 8b7a314474
commit 7339b9bce7
3 changed files with 7 additions and 10 deletions

2
Cargo.lock generated
View File

@ -2714,7 +2714,7 @@ dependencies = [
[[package]]
name = "tree-sitter"
version = "0.19.5"
source = "git+https://github.com/tree-sitter/tree-sitter?rev=97dfee63257b5e92197399b381aa993514640adf#97dfee63257b5e92197399b381aa993514640adf"
source = "git+https://github.com/tree-sitter/tree-sitter?rev=d72771a19f4143530b1cfd23808e344f1276e176#d72771a19f4143530b1cfd23808e344f1276e176"
dependencies = [
"cc",
"regex",

View File

@ -3,7 +3,7 @@ members = ["zed", "gpui", "gpui_macros", "fsevent", "scoped_pool"]
[patch.crates-io]
async-task = { git = "https://github.com/zed-industries/async-task", rev = "341b57d6de98cdfd7b418567b8de2022ca993a6e" }
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "97dfee63257b5e92197399b381aa993514640adf" }
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "d72771a19f4143530b1cfd23808e344f1276e176" }
# TODO - Remove when a version is released with this PR: https://github.com/servo/core-foundation-rs/pull/457
cocoa = { git = "https://github.com/servo/core-foundation-rs", rev = "025dcb3c0d1ef01530f57ef65f3b1deb948f5737" }

View File

@ -99,8 +99,8 @@ impl DerefMut for QueryCursorHandle {
impl Drop for QueryCursorHandle {
fn drop(&mut self) {
let mut cursor = self.0.take().unwrap();
cursor.set_byte_range(0, usize::MAX);
cursor.set_point_range(Point::zero().into(), Point::MAX.into());
cursor.set_byte_range(0..usize::MAX);
cursor.set_point_range(Point::zero().into()..Point::MAX.into());
QUERY_CURSORS.lock().push(cursor)
}
}
@ -734,7 +734,7 @@ impl Buffer {
// Find bracket pairs that *inclusively* contain the given range.
let range = range.start.to_offset(self).saturating_sub(1)..range.end.to_offset(self) + 1;
let mut cursor = QueryCursorHandle::new();
let matches = cursor.set_byte_range(range.start, range.end).matches(
let matches = cursor.set_byte_range(range).matches(
&lang.brackets_query,
tree.root_node(),
TextProvider(&self.visible_text),
@ -2142,12 +2142,11 @@ impl Snapshot {
pub fn highlighted_text_for_range(&mut self, range: Range<usize>) -> HighlightedChunks {
let chunks = self.text.chunks_in_range(range.clone());
if let Some((language, tree)) = self.language.as_ref().zip(self.tree.as_ref()) {
let mut captures = self.query_cursor.captures(
let captures = self.query_cursor.set_byte_range(range.clone()).captures(
&language.highlight_query,
tree.root_node(),
TextProvider(&self.text),
);
captures.set_byte_range(range.start, range.end);
HighlightedChunks {
range,
@ -2360,9 +2359,7 @@ impl<'a> HighlightedChunks<'a> {
highlights.next_capture.take();
}
}
highlights
.captures
.set_byte_range(self.range.start, self.range.end);
highlights.captures.set_byte_range(self.range.clone());
}
}