Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

language: Fix flaky bracket range deduplication test (#62996)

Smit Barmaseab208db8d264
diff --git a/crates/language/src/buffer_tests.rs b/crates/language/src/buffer_tests.rs
index 26e856ac189..f5b08929066 100644
--- a/crates/language/src/buffer_tests.rs
+++ b/crates/language/src/buffer_tests.rs
@@ -1666,7 +1666,7 @@ fn test_bracket_ranges_keep_pairs_straddling_a_chunk_boundary_amid_errors(cx: &m
}
#[gpui::test]
-fn test_bracket_ranges_deduplicate_overlapping_patterns(cx: &mut App) {
+async fn test_bracket_ranges_deduplicate_overlapping_patterns(cx: &mut TestAppContext) {
let text = indoc! {r#"
CLAY(CLAY_ID("MenuContainer"),
CLAY_RECTANGLE({.color = {43, 41, 51, 255}}),
@@ -1693,7 +1693,10 @@ fn test_bracket_ranges_deduplicate_overlapping_patterns(cx: &mut App) {
.unwrap(),
);
let buffer = cx.new(|cx| Buffer::local(text, cx).with_language(language, cx));
- let snapshot = buffer.read(cx).snapshot();
+ buffer
+ .read_with(cx, |buffer, _| buffer.parsing_idle())
+ .await;
+ let snapshot = buffer.read_with(cx, |buffer, _| buffer.snapshot());
assert_has_syntax_errors(&snapshot);
let mut matches = snapshot