sum_tree: Replace rayon with futures (#41586)
Release Notes: - N/A *or* Added/Fixed/Improved ... Co-authored by: Kate <kate@zed.dev>
This commit is contained in:
@@ -700,16 +700,20 @@ impl InlayMap {
|
||||
.collect::<String>();
|
||||
|
||||
let next_inlay = if i % 2 == 0 {
|
||||
use rope::Rope;
|
||||
|
||||
Inlay::mock_hint(
|
||||
post_inc(next_inlay_id),
|
||||
snapshot.buffer.anchor_at(position, bias),
|
||||
&text,
|
||||
Rope::from_str_small(&text),
|
||||
)
|
||||
} else {
|
||||
use rope::Rope;
|
||||
|
||||
Inlay::edit_prediction(
|
||||
post_inc(next_inlay_id),
|
||||
snapshot.buffer.anchor_at(position, bias),
|
||||
&text,
|
||||
Rope::from_str_small(&text),
|
||||
)
|
||||
};
|
||||
let inlay_id = next_inlay.id;
|
||||
@@ -1301,7 +1305,7 @@ mod tests {
|
||||
vec![Inlay::mock_hint(
|
||||
post_inc(&mut next_inlay_id),
|
||||
buffer.read(cx).snapshot(cx).anchor_after(3),
|
||||
"|123|",
|
||||
Rope::from_str_small("|123|"),
|
||||
)],
|
||||
);
|
||||
assert_eq!(inlay_snapshot.text(), "abc|123|defghi");
|
||||
@@ -1378,12 +1382,12 @@ mod tests {
|
||||
Inlay::mock_hint(
|
||||
post_inc(&mut next_inlay_id),
|
||||
buffer.read(cx).snapshot(cx).anchor_before(3),
|
||||
"|123|",
|
||||
Rope::from_str_small("|123|"),
|
||||
),
|
||||
Inlay::edit_prediction(
|
||||
post_inc(&mut next_inlay_id),
|
||||
buffer.read(cx).snapshot(cx).anchor_after(3),
|
||||
"|456|",
|
||||
Rope::from_str_small("|456|"),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -1593,17 +1597,17 @@ mod tests {
|
||||
Inlay::mock_hint(
|
||||
post_inc(&mut next_inlay_id),
|
||||
buffer.read(cx).snapshot(cx).anchor_before(0),
|
||||
"|123|\n",
|
||||
Rope::from_str_small("|123|\n"),
|
||||
),
|
||||
Inlay::mock_hint(
|
||||
post_inc(&mut next_inlay_id),
|
||||
buffer.read(cx).snapshot(cx).anchor_before(4),
|
||||
"|456|",
|
||||
Rope::from_str_small("|456|"),
|
||||
),
|
||||
Inlay::edit_prediction(
|
||||
post_inc(&mut next_inlay_id),
|
||||
buffer.read(cx).snapshot(cx).anchor_before(7),
|
||||
"\n|567|\n",
|
||||
Rope::from_str_small("\n|567|\n"),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -1677,9 +1681,14 @@ mod tests {
|
||||
(offset, inlay.clone())
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let mut expected_text = Rope::from(&buffer_snapshot.text());
|
||||
let mut expected_text =
|
||||
Rope::from_str(&buffer_snapshot.text(), cx.background_executor());
|
||||
for (offset, inlay) in inlays.iter().rev() {
|
||||
expected_text.replace(*offset..*offset, &inlay.text().to_string());
|
||||
expected_text.replace(
|
||||
*offset..*offset,
|
||||
&inlay.text().to_string(),
|
||||
cx.background_executor(),
|
||||
);
|
||||
}
|
||||
assert_eq!(inlay_snapshot.text(), expected_text.to_string());
|
||||
|
||||
@@ -2067,7 +2076,7 @@ mod tests {
|
||||
let inlay = Inlay {
|
||||
id: InlayId::Hint(0),
|
||||
position,
|
||||
content: InlayContent::Text(text::Rope::from(inlay_text)),
|
||||
content: InlayContent::Text(text::Rope::from_str(inlay_text, cx.background_executor())),
|
||||
};
|
||||
|
||||
let (inlay_snapshot, _) = inlay_map.splice(&[], vec![inlay]);
|
||||
@@ -2181,7 +2190,10 @@ mod tests {
|
||||
let inlay = Inlay {
|
||||
id: InlayId::Hint(0),
|
||||
position,
|
||||
content: InlayContent::Text(text::Rope::from(test_case.inlay_text)),
|
||||
content: InlayContent::Text(text::Rope::from_str(
|
||||
test_case.inlay_text,
|
||||
cx.background_executor(),
|
||||
)),
|
||||
};
|
||||
|
||||
let (inlay_snapshot, _) = inlay_map.splice(&[], vec![inlay]);
|
||||
|
||||
Reference in New Issue
Block a user