Skip to content

Commit ec7ad89

Browse files
authored
Merge pull request #18373 from Veykril/veykril/push-mzumrrvynxqu
internal: Merge separate inlay hints targeting same range
2 parents 5482247 + 770df7f commit ec7ad89

File tree

4 files changed

+153
-246
lines changed

4 files changed

+153
-246
lines changed

src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,18 @@ impl InlayHintLabel {
475475
}
476476
}
477477

478+
pub fn append_part(&mut self, part: InlayHintLabelPart) {
479+
if part.linked_location.is_none() && part.tooltip.is_none() {
480+
if let Some(InlayHintLabelPart { text, linked_location: None, tooltip: None }) =
481+
self.parts.last_mut()
482+
{
483+
text.push_str(&part.text);
484+
return;
485+
}
486+
}
487+
self.parts.push(part);
488+
}
489+
478490
pub fn needs_resolve(&self) -> bool {
479491
self.parts.iter().any(|part| part.linked_location.is_some() || part.tooltip.is_some())
480492
}

0 commit comments

Comments
 (0)