fix: Don't emit empty inlay hint parts

This commit is contained in:
Lukas Wirth 2024-09-12 08:37:38 +02:00
parent 77e1969c15
commit 0bb7a8e28b
4 changed files with 24 additions and 38 deletions

View file

@ -577,11 +577,14 @@ impl HirWrite for InlayHintLabelBuilder<'_> {
impl InlayHintLabelBuilder<'_> {
fn make_new_part(&mut self) {
self.result.parts.push(InlayHintLabelPart {
text: take(&mut self.last_part),
linked_location: self.location.take(),
tooltip: None,
});
let text = take(&mut self.last_part);
if !text.is_empty() {
self.result.parts.push(InlayHintLabelPart {
text,
linked_location: self.location.take(),
tooltip: None,
});
}
}
fn finish(mut self) -> InlayHintLabel {