Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/inlay_hints/binding_mode.rs')
| -rw-r--r-- | crates/ide/src/inlay_hints/binding_mode.rs | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/crates/ide/src/inlay_hints/binding_mode.rs b/crates/ide/src/inlay_hints/binding_mode.rs index ed2bd8d2a8..5bbb4fe4e6 100644 --- a/crates/ide/src/inlay_hints/binding_mode.rs +++ b/crates/ide/src/inlay_hints/binding_mode.rs @@ -99,17 +99,24 @@ pub(super) fn hints( } if let hints @ [_, ..] = &mut acc[acc_base..] { - let mut edit = TextEditBuilder::default(); - for h in &mut *hints { - edit.insert( - match h.position { - InlayHintPosition::Before => h.range.start(), - InlayHintPosition::After => h.range.end(), - }, - h.label.parts.iter().map(|p| &*p.text).chain(h.pad_right.then_some(" ")).collect(), - ); - } - let edit = edit.finish(); + let edit = config.lazy_text_edit(|| { + let mut edit = TextEditBuilder::default(); + for h in &mut *hints { + edit.insert( + match h.position { + InlayHintPosition::Before => h.range.start(), + InlayHintPosition::After => h.range.end(), + }, + h.label + .parts + .iter() + .map(|p| &*p.text) + .chain(h.pad_right.then_some(" ")) + .collect(), + ); + } + edit.finish() + }); hints.iter_mut().for_each(|h| h.text_edit = Some(edit.clone())); } |