feat: make star import tooltip more human readable (#682)

This commit is contained in:
Myriad-Dreamin 2024-10-15 21:26:45 +08:00 committed by GitHub
parent c17e0c787e
commit 190b7dfd45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -196,19 +196,9 @@ fn star_tooltip(
let mut names = scope.iter().map(|(name, _)| name).collect::<Vec<_>>();
names.sort();
let mut items = String::new();
items.push_str("let (");
for name in &names {
items.push_str(name);
items.push_str(", ");
}
items.push_str(") = ..");
results.push(MarkedString::LanguageString(LanguageString {
language: "typc".to_owned(),
value: items,
}));
let items = typst::foundations::repr::separated_list(&names, "and");
results.push(MarkedString::String(format!("This star imports {items}")));
Some(LspHoverContents::Array(results))
}