mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 06:59:22 +01:00
Update Tree-sitter and extension grammar memory imports (#66185)
This PR changes two things: * Bumps the Tree-sitter dependency to include the grammar-loader commit from [Tree-sitter PR #6046](https://github.com/tree-sitter/tree-sitter/pull/6046). - Update the extension builder to compile Zed extension grammars with an explicit maximum size on their memory import. This makes it possible to change the modules to work with a *shared* memory setting (needed for multi-threaded parsing) on the Web, more efficiently. Shared memory imports need an explicit max size, so this way we can change the import to shared without having to move any bytes to make room for the max size declaration. Release Notes: - N/A
This commit is contained in:
Generated
+20
-21
@@ -2737,7 +2737,7 @@ dependencies = [
|
||||
"maybe-owned",
|
||||
"rustix",
|
||||
"rustix-linux-procfs",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
"winx",
|
||||
]
|
||||
|
||||
@@ -5009,7 +5009,7 @@ dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5795,7 +5795,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6855,7 +6855,7 @@ dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"rustversion",
|
||||
"windows-link 0.2.1",
|
||||
"windows-link 0.1.3",
|
||||
"windows-result 0.4.1",
|
||||
]
|
||||
|
||||
@@ -6987,7 +6987,7 @@ dependencies = [
|
||||
"gobject-sys",
|
||||
"libc",
|
||||
"system-deps",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -11000,7 +11000,7 @@ version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -11378,7 +11378,7 @@ version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -14111,8 +14111,8 @@ version = "0.14.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"itertools 0.14.0",
|
||||
"heck 0.4.1",
|
||||
"itertools 0.10.5",
|
||||
"log",
|
||||
"multimap",
|
||||
"petgraph",
|
||||
@@ -14131,7 +14131,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"itertools 0.14.0",
|
||||
"itertools 0.10.5",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
@@ -15512,7 +15512,7 @@ dependencies = [
|
||||
"errno 0.3.14",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -15610,7 +15610,7 @@ dependencies = [
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -16804,7 +16804,7 @@ version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"heck 0.4.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
@@ -16873,7 +16873,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -17187,7 +17187,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"psm",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -17904,7 +17904,7 @@ dependencies = [
|
||||
"getrandom 0.4.1",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -18819,12 +18819,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter"
|
||||
version = "0.27.0"
|
||||
source = "git+https://github.com/tree-sitter/tree-sitter?rev=43623ec9bf0eaaf7113285c46e8a09018f181b18#43623ec9bf0eaaf7113285c46e8a09018f181b18"
|
||||
version = "0.28.0"
|
||||
source = "git+https://github.com/tree-sitter/tree-sitter?rev=803c6ebaac27d69e1808b45058482e868d073ceb#803c6ebaac27d69e1808b45058482e868d073ceb"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"regex",
|
||||
"serde_json",
|
||||
"streaming-iterator",
|
||||
"tree-sitter-language",
|
||||
"wasmtime-c-api-impl",
|
||||
@@ -18977,7 +18976,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tree-sitter-language"
|
||||
version = "0.1.8"
|
||||
source = "git+https://github.com/tree-sitter/tree-sitter?rev=43623ec9bf0eaaf7113285c46e8a09018f181b18#43623ec9bf0eaaf7113285c46e8a09018f181b18"
|
||||
source = "git+https://github.com/tree-sitter/tree-sitter?rev=803c6ebaac27d69e1808b45058482e868d073ceb#803c6ebaac27d69e1808b45058482e868d073ceb"
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-md"
|
||||
@@ -20727,7 +20726,7 @@ version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
+2
-2
@@ -937,7 +937,7 @@ tokio-rustls = { version = "0.26", default-features = false }
|
||||
toml = { version = "0.9", default-features = false, features = ["std", "serde", "parse"] }
|
||||
toml_edit = { version = "0.22", default-features = false, features = ["parse"] }
|
||||
tower-http = "0.4.4"
|
||||
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "43623ec9bf0eaaf7113285c46e8a09018f181b18" }
|
||||
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "803c6ebaac27d69e1808b45058482e868d073ceb" }
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = "0.3"
|
||||
tree-sitter-bash = "0.25.1"
|
||||
@@ -1035,7 +1035,7 @@ cpal = { git = "https://github.com/RustAudio/cpal", rev = "e1612d5d98152f8dc2a62
|
||||
# Unify `tree_sitter_language::LanguageFn` between crates.io grammar crates and
|
||||
# the git tree-sitter above; two instances of the crate would make grammar
|
||||
# constants type-incompatible with `tree_sitter::Language`.
|
||||
tree-sitter-language = { git = "https://github.com/tree-sitter/tree-sitter", rev = "43623ec9bf0eaaf7113285c46e8a09018f181b18" }
|
||||
tree-sitter-language = { git = "https://github.com/tree-sitter/tree-sitter", rev = "803c6ebaac27d69e1808b45058482e868d073ceb" }
|
||||
async-process = { git = "https://github.com/zed-industries/async-process.git", rev = "0b6d6713570af61806e1e5cb40e0f757cb93fd9d" }
|
||||
async-task = { git = "https://github.com/zed-industries/async-task.git", rev = "015845a19fc31752c02367567d3b8900a406f9da" }
|
||||
windows-capture = { git = "https://github.com/zed-industries/windows-capture.git", rev = "f0d6c1b6691db75461b732f6d5ff56eed002eeb9" }
|
||||
|
||||
@@ -442,7 +442,7 @@ fn extract_declarations_from_tree(
|
||||
let mut name_range: Option<Range<usize>> = None;
|
||||
let mut has_item_range = false;
|
||||
|
||||
for capture in query_match.captures {
|
||||
for capture in query_match.captures() {
|
||||
let range = capture.node.byte_range();
|
||||
if capture.index == outline_config.name_capture_ix {
|
||||
name_range = Some(range);
|
||||
|
||||
@@ -309,6 +309,9 @@ impl ExtensionBuilder {
|
||||
let clang_output = util::command::new_command(&clang_path)
|
||||
.args(["-fPIC", "-shared", "-Os"])
|
||||
.arg(format!("-Wl,--export=tree_sitter_{grammar_name}"))
|
||||
// An explicit maximum lets a browser loader make this imported memory
|
||||
// shared by changing only its flags, without altering its limits.
|
||||
.arg("-Wl,--max-memory=4294967296")
|
||||
.arg("-o")
|
||||
.arg(&grammar_wasm_path)
|
||||
.arg("-I")
|
||||
|
||||
@@ -1198,7 +1198,7 @@ impl Language {
|
||||
let mut captures = cursor.captures(query, tree.root_node(), text.text_provider());
|
||||
let capture_refs = iter::from_fn(move || {
|
||||
let (query_match, capture_index) = captures.next()?;
|
||||
let capture = query_match.captures[*capture_index];
|
||||
let capture = query_match.captures()[*capture_index];
|
||||
Some((
|
||||
capture.node.byte_range(),
|
||||
HighlightCaptureRef {
|
||||
|
||||
@@ -1466,7 +1466,7 @@ impl<'a> SyntaxMapMatches<'a> {
|
||||
|
||||
impl SyntaxMapCapturesLayer<'_> {
|
||||
fn advance(&mut self) {
|
||||
self.next_capture = self.captures.next().map(|(mat, ix)| mat.captures[*ix]);
|
||||
self.next_capture = self.captures.next().map(|(mat, ix)| mat.captures()[*ix]);
|
||||
}
|
||||
|
||||
fn sort_key(&self) -> (usize, Reverse<usize>, usize) {
|
||||
@@ -1487,7 +1487,7 @@ impl SyntaxMapMatchesLayer<'_> {
|
||||
continue;
|
||||
}
|
||||
self.next_captures.clear();
|
||||
self.next_captures.extend_from_slice(mat.captures);
|
||||
self.next_captures.extend_from_slice(mat.captures());
|
||||
self.next_pattern_index = mat.pattern_index;
|
||||
self.has_next = true;
|
||||
return;
|
||||
@@ -1546,7 +1546,7 @@ fn has_parent(args: &[QueryPredicateArg], mat: &QueryMatch) -> bool {
|
||||
return false;
|
||||
};
|
||||
|
||||
let Some(capture) = mat.captures.iter().find(|c| c.index == *capture_ix) else {
|
||||
let Some(capture) = mat.captures().iter().find(|c| c.index == *capture_ix) else {
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -2002,7 +2002,7 @@ impl<'a> SyntaxLayer<'a> {
|
||||
let mut smallest_match: Option<(u32, Range<usize>)> = None;
|
||||
let mut matches = query_cursor.matches(&config.query, self.node(), text);
|
||||
while let Some(mat) = matches.next() {
|
||||
for capture in mat.captures {
|
||||
for capture in mat.captures() {
|
||||
let Some(override_entry) = config.values.get(&capture.index) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
@@ -80,7 +80,7 @@ fn test_query_text_inside_multibyte_character() -> anyhow::Result<()> {
|
||||
let mut cursor = QueryCursor::new();
|
||||
let mut matches = cursor.matches(&query, tree.root_node(), TextProvider(&text));
|
||||
let query_match = matches.next().expect("predicate matches the error node");
|
||||
let node = query_match.captures.first().expect("error capture").node;
|
||||
let node = query_match.captures().first().expect("error capture").node;
|
||||
assert_eq!(node.start_byte(), range.start_byte);
|
||||
assert!(!source.is_char_boundary(node.start_byte()));
|
||||
assert_eq!(
|
||||
|
||||
@@ -133,12 +133,12 @@ pub fn replace_value_in_json_text<T: AsRef<str>>(
|
||||
|
||||
let mut matches = cursor.matches(&PAIR_QUERY, syntax_tree.root_node(), text.as_bytes());
|
||||
while let Some(mat) = matches.next() {
|
||||
if mat.captures.len() != 2 {
|
||||
if mat.captures().len() != 2 {
|
||||
continue;
|
||||
}
|
||||
|
||||
let key_range = mat.captures[0].node.byte_range();
|
||||
let value_range = mat.captures[1].node.byte_range();
|
||||
let key_range = mat.captures()[0].node.byte_range();
|
||||
let value_range = mat.captures()[1].node.byte_range();
|
||||
|
||||
// Don't enter sub objects until we find an exact
|
||||
// match for the current keypath
|
||||
@@ -176,8 +176,8 @@ pub fn replace_value_in_json_text<T: AsRef<str>>(
|
||||
}
|
||||
|
||||
if let Some(array_replacement) = handle_possible_array_value(
|
||||
&mat.captures[0].node,
|
||||
&mat.captures[1].node,
|
||||
&mat.captures()[0].node,
|
||||
&mat.captures()[1].node,
|
||||
text,
|
||||
&key_path[depth..],
|
||||
new_value,
|
||||
|
||||
@@ -55,7 +55,7 @@ pub fn insert_task_json_into_editor(
|
||||
|
||||
let mut last_offset = None;
|
||||
while let Some(mat) = matches.next() {
|
||||
if let Some(pos) = mat.captures.first().map(|m| m.node.byte_range().end) {
|
||||
if let Some(pos) = mat.captures().first().map(|m| m.node.byte_range().end) {
|
||||
last_offset = Some(MultiBufferOffset(pos))
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ pub fn insert_task_json_into_editor(
|
||||
);
|
||||
|
||||
if let Some(mat) = matches.next() {
|
||||
if let Some(pos) = mat.captures.first().map(|m| m.node.byte_range().end - 1) {
|
||||
if let Some(pos) = mat.captures().first().map(|m| m.node.byte_range().end - 1) {
|
||||
edits.push((
|
||||
MultiBufferOffset(pos)..MultiBufferOffset(pos),
|
||||
format!("\n{new_task}\n"),
|
||||
|
||||
Reference in New Issue
Block a user