Bump Tree-sitter for bug fixes affecting YAML parser loaded via WASM (#25054)

Closes https://github.com/zed-industries/zed/issues/24742
Closes #24632

This PR bumps Tree-sitter to bring in bug fixes:
* https://github.com/tree-sitter/tree-sitter/pull/4218
* https://github.com/tree-sitter/tree-sitter/pull/4213
* https://github.com/tree-sitter/tree-sitter/pull/4210

I've also bumped Wasmtime and wit-bindgen, since the new Tree-sitter
uses a newer wasmtime.

Release Notes:

- Fixed a parsing bug that caused memory leaks and crashes when using
the Ansible extension

---------

Co-authored-by: Anthony <anthony@zed.dev>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This commit is contained in:
Max Brunsfeld 2025-02-17 21:29:27 -08:00 committed by GitHub
parent 8942e657aa
commit 813d870a03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 225 additions and 211 deletions

View file

@ -2915,7 +2915,7 @@ impl BufferSnapshot {
let mut error_ranges = Vec::<Range<Point>>::new();
let mut matches = self.syntax.matches(range.clone(), &self.text, |grammar| {
Some(&grammar.error_query)
grammar.error_query.as_ref()
});
while let Some(mat) = matches.peek() {
let node = mat.captures[0].node;

View file

@ -3149,7 +3149,7 @@ fn html_lang() -> Language {
block_comment: Some(("<!--".into(), "-->".into())),
..Default::default()
},
Some(tree_sitter_html::language()),
Some(tree_sitter_html::LANGUAGE.into()),
)
.with_indents_query(
"

View file

@ -915,7 +915,7 @@ impl GrammarId {
pub struct Grammar {
id: GrammarId,
pub ts_language: tree_sitter::Language,
pub(crate) error_query: Query,
pub(crate) error_query: Option<Query>,
pub(crate) highlights_query: Option<Query>,
pub(crate) brackets_config: Option<BracketConfig>,
pub(crate) redactions_config: Option<RedactionConfig>,
@ -1070,7 +1070,7 @@ impl Language {
override_config: None,
redactions_config: None,
runnable_config: None,
error_query: Query::new(&ts_language, "(ERROR) @error").unwrap(),
error_query: Query::new(&ts_language, "(ERROR) @error").ok(),
ts_language,
highlight_map: Default::default(),
})
@ -1723,12 +1723,13 @@ impl Grammar {
.expect("incompatible grammar");
let mut chunks = text.chunks_in_range(0..text.len());
parser
.parse_with(
.parse_with_options(
&mut move |offset, _| {
chunks.seek(offset);
chunks.next().unwrap_or("").as_bytes()
},
old_tree.as_ref(),
None,
)
.unwrap()
})

View file

@ -1238,12 +1238,13 @@ fn parse_text(
parser.set_included_ranges(&ranges)?;
parser.set_language(&grammar.ts_language)?;
parser
.parse_with(
.parse_with_options(
&mut move |offset, _| {
chunks.seek(start_byte + offset);
chunks.next().unwrap_or("").as_bytes()
},
old_tree.as_ref(),
None,
)
.ok_or_else(|| anyhow::anyhow!("failed to parse"))
})

View file

@ -1134,7 +1134,7 @@ fn html_lang() -> Language {
},
..Default::default()
},
Some(tree_sitter_html::language()),
Some(tree_sitter_html::LANGUAGE.into()),
)
.with_highlights_query(
r#"