Always clear refactoring text highlights, even if an error occurs
This commit is contained in:
parent
71a5964c18
commit
2468506189
1 changed files with 10 additions and 4 deletions
|
@ -101,6 +101,16 @@ impl RefactoringAssistant {
|
||||||
editor.id(),
|
editor.id(),
|
||||||
cx.spawn(|mut cx| {
|
cx.spawn(|mut cx| {
|
||||||
async move {
|
async move {
|
||||||
|
let _clear_highlights = util::defer({
|
||||||
|
let mut cx = cx.clone();
|
||||||
|
let editor = editor.clone();
|
||||||
|
move || {
|
||||||
|
let _ = editor.update(&mut cx, |editor, cx| {
|
||||||
|
editor.clear_text_highlights::<Self>(cx);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let mut edit_start = selection.start.to_offset(&snapshot);
|
let mut edit_start = selection.start.to_offset(&snapshot);
|
||||||
|
|
||||||
let (mut hunks_tx, mut hunks_rx) = mpsc::channel(1);
|
let (mut hunks_tx, mut hunks_rx) = mpsc::channel(1);
|
||||||
|
@ -215,11 +225,7 @@ impl RefactoringAssistant {
|
||||||
);
|
);
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff.await?;
|
diff.await?;
|
||||||
editor.update(&mut cx, |editor, cx| {
|
|
||||||
editor.clear_text_highlights::<Self>(cx);
|
|
||||||
})?;
|
|
||||||
|
|
||||||
anyhow::Ok(())
|
anyhow::Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue