Skip to content

Commit

Permalink
Merge pull request #18373 from Veykril/veykril/push-mzumrrvynxqu
Browse files Browse the repository at this point in the history
internal: Merge separate inlay hints targeting same range
  • Loading branch information
Veykril authored Oct 22, 2024
2 parents 1b00f08 + 3ae93bc commit b35d93c
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 246 deletions.
12 changes: 12 additions & 0 deletions crates/ide/src/inlay_hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,18 @@ impl InlayHintLabel {
}
}

pub fn append_part(&mut self, part: InlayHintLabelPart) {
if part.linked_location.is_none() && part.tooltip.is_none() {
if let Some(InlayHintLabelPart { text, linked_location: None, tooltip: None }) =
self.parts.last_mut()
{
text.push_str(&part.text);
return;
}
}
self.parts.push(part);
}

pub fn needs_resolve(&self) -> bool {
self.parts.iter().any(|part| part.linked_location.is_some() || part.tooltip.is_some())
}
Expand Down
Loading

0 comments on commit b35d93c

Please sign in to comment.