mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 18:46:49 +00:00
Clear active copilot suggestion only if there is one
This commit is contained in:
parent
ec5309b543
commit
b88aa9af1d
1 changed files with 5 additions and 2 deletions
|
@ -2922,9 +2922,11 @@ impl Editor {
|
||||||
fn refresh_active_copilot_suggestion(&mut self, cx: &mut ViewContext<Self>) {
|
fn refresh_active_copilot_suggestion(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
let snapshot = self.buffer.read(cx).snapshot(cx);
|
let snapshot = self.buffer.read(cx).snapshot(cx);
|
||||||
let cursor = self.selections.newest_anchor().head();
|
let cursor = self.selections.newest_anchor().head();
|
||||||
|
|
||||||
if self.context_menu.is_some() {
|
if self.context_menu.is_some() {
|
||||||
self.display_map
|
self.display_map
|
||||||
.update(cx, |map, cx| map.replace_suggestion::<usize>(None, cx));
|
.update(cx, |map, cx| map.replace_suggestion::<usize>(None, cx));
|
||||||
|
cx.notify();
|
||||||
} else if let Some(text) = self
|
} else if let Some(text) = self
|
||||||
.copilot_state
|
.copilot_state
|
||||||
.text_for_active_completion(cursor, &snapshot)
|
.text_for_active_completion(cursor, &snapshot)
|
||||||
|
@ -2938,11 +2940,12 @@ impl Editor {
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
} else {
|
cx.notify();
|
||||||
|
} else if self.has_active_copilot_suggestion(cx) {
|
||||||
self.display_map
|
self.display_map
|
||||||
.update(cx, |map, cx| map.replace_suggestion::<usize>(None, cx));
|
.update(cx, |map, cx| map.replace_suggestion::<usize>(None, cx));
|
||||||
|
cx.notify();
|
||||||
}
|
}
|
||||||
cx.notify();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn accept_copilot_suggestion(&mut self, cx: &mut ViewContext<Self>) -> bool {
|
fn accept_copilot_suggestion(&mut self, cx: &mut ViewContext<Self>) -> bool {
|
||||||
|
|
Loading…
Reference in a new issue