adjust inlay hint api to remove just based on character index and not the completion as well

pull/8675/head
Matt Paras 2025-06-15 17:24:21 -07:00
parent f582c8b7bd
commit 629bb38be6
1 changed files with 3 additions and 3 deletions

View File

@ -5103,8 +5103,8 @@ pub fn add_inlay_hint(cx: &mut Context, char_index: usize, completion: SteelStri
} }
// "remove-inlay-hint", // "remove-inlay-hint",
pub fn remove_inlay_hint(cx: &mut Context, char_index: usize, completion: SteelString) -> bool { pub fn remove_inlay_hint(cx: &mut Context, char_index: usize, _completion: SteelString) -> bool {
let text = completion.to_string(); // let text = completion.to_string();
let view_id = cx.editor.tree.focus; let view_id = cx.editor.tree.focus;
if !cx.editor.tree.contains(view_id) { if !cx.editor.tree.contains(view_id) {
return false; return false;
@ -5122,7 +5122,7 @@ pub fn remove_inlay_hint(cx: &mut Context, char_index: usize, completion: SteelS
let mut new_inlay_hints = inlay_hints.clone(); let mut new_inlay_hints = inlay_hints.clone();
new_inlay_hints new_inlay_hints
.other_inlay_hints .other_inlay_hints
.retain(|x| x.char_idx != char_index && x.text != text); .retain(|x| x.char_idx != char_index);
doc.set_inlay_hints(view_id, new_inlay_hints); doc.set_inlay_hints(view_id, new_inlay_hints);
true true
} }