Clear Copilot suggestions when it gets disabled from the settings

This commit is contained in:
Antonio Scandurra 2023-04-04 10:45:56 +02:00
parent abf158a9e4
commit 79d5bb45dc
5 changed files with 26 additions and 35 deletions

View file

@ -228,13 +228,8 @@ impl CopilotButton {
Copilot::global(cx).map(|copilot| cx.observe(&copilot, |_, _, cx| cx.notify()).detach());
let this_handle = cx.handle().downgrade();
cx.observe_global::<Settings, _>(move |cx| {
if let Some(handle) = this_handle.upgrade(cx) {
handle.update(cx, |_, cx| cx.notify())
}
})
.detach();
cx.observe_global::<Settings, _>(move |_, cx| cx.notify())
.detach();
Self {
popup_menu: menu,