language: Only block the foreground on buffer reparsing when necessary (#43888)

Gist is we only need to block the foreground thread for reparsing if
immediate language changes are useful to the user. That is usually only
the case when they edit the buffer

Release Notes:

- Improved performance of large project searches and project diffs

Co-authored by: David Kleingeld <david@zed.dev>
This commit is contained in:
Lukas Wirth
2025-12-01 14:57:15 +01:00
committed by GitHub
parent 3969109aa3
commit 9af6e82e65
54 changed files with 363 additions and 250 deletions
+1 -1
View File
@@ -3244,7 +3244,7 @@ mod test {
let buffer_ids = multi_buffer.read(cx).excerpt_buffer_ids();
if let Some(buffer) = multi_buffer.read(cx).buffer(buffer_ids[1]) {
buffer.update(cx, |buffer, cx| {
buffer.set_language(Some(language::rust_lang()), cx);
buffer.set_language_immediate(Some(language::rust_lang()), cx);
})
};
+2 -2
View File
@@ -1478,7 +1478,7 @@ async fn test_toggle_comments(cx: &mut gpui::TestAppContext) {
},
Some(language::tree_sitter_rust::LANGUAGE.into()),
));
cx.update_buffer(|buffer, cx| buffer.set_language(Some(language), cx));
cx.update_buffer(|buffer, cx| buffer.set_language_immediate(Some(language), cx));
// works in normal model
cx.set_state(
@@ -2363,7 +2363,7 @@ async fn test_wrap_selections_in_tag_line_mode(cx: &mut gpui::TestAppContext) {
None,
));
cx.update_buffer(|buffer, cx| buffer.set_language(Some(js_language), cx));
cx.update_buffer(|buffer, cx| buffer.set_language_immediate(Some(js_language), cx));
cx.set_state(
indoc! {