editor: Make parse_blocks synchronous since it has no await points (#54756)

Release Notes:

- N/A

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
This commit is contained in:
Xiaobo Liu 2026-04-24 18:40:20 +08:00 committed by GitHub
parent adab7b8871
commit 93e9bef8a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -205,8 +205,7 @@ pub fn hover_at_inlay(
let language_registry = project.read_with(cx, |p, _| p.languages().clone());
let blocks = vec![inlay_hover.tooltip];
let parsed_content =
parse_blocks(&blocks, Some(&language_registry), None, cx).await;
let parsed_content = parse_blocks(&blocks, Some(&language_registry), None, cx);
let scroll_handle = ScrollHandle::new();
@ -494,8 +493,7 @@ fn show_hover(
text: format!("Unicode character U+{:02X}", invisible as u32),
kind: HoverBlockKind::PlainText,
}];
let parsed_content =
parse_blocks(&blocks, language_registry.as_ref(), None, cx).await;
let parsed_content = parse_blocks(&blocks, language_registry.as_ref(), None, cx);
let scroll_handle = ScrollHandle::new();
let subscription = this
.update(cx, |_, cx| {
@ -536,7 +534,7 @@ fn show_hover(
let blocks = hover_result.contents;
let language = hover_result.language;
let parsed_content =
parse_blocks(&blocks, language_registry.as_ref(), language, cx).await;
parse_blocks(&blocks, language_registry.as_ref(), language, cx);
let scroll_handle = ScrollHandle::new();
hover_highlights.push(range.clone());
let subscription = this
@ -623,7 +621,7 @@ fn same_diagnostic_hover(editor: &Editor, snapshot: &EditorSnapshot, anchor: Anc
.unwrap_or(false)
}
async fn parse_blocks(
fn parse_blocks(
blocks: &[HoverBlock],
language_registry: Option<&Arc<LanguageRegistry>>,
language: Option<Arc<Language>>,