mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 19:05:08 +03:00
Don't update active completion for editors that are not focused (#9904)
Release Notes: - N/A
This commit is contained in:
parent
eaec04632a
commit
c33ee52046
@ -764,6 +764,7 @@ mod tests {
|
|||||||
multibuffer
|
multibuffer
|
||||||
});
|
});
|
||||||
let editor = cx.add_window(|cx| Editor::for_multibuffer(multibuffer, None, cx));
|
let editor = cx.add_window(|cx| Editor::for_multibuffer(multibuffer, None, cx));
|
||||||
|
editor.update(cx, |editor, cx| editor.focus(cx)).unwrap();
|
||||||
let copilot_provider = cx.new_model(|_| CopilotCompletionProvider::new(copilot));
|
let copilot_provider = cx.new_model(|_| CopilotCompletionProvider::new(copilot));
|
||||||
editor
|
editor
|
||||||
.update(cx, |editor, cx| {
|
.update(cx, |editor, cx| {
|
||||||
|
@ -1676,7 +1676,9 @@ impl Editor {
|
|||||||
) {
|
) {
|
||||||
self.inline_completion_provider = Some(RegisteredInlineCompletionProvider {
|
self.inline_completion_provider = Some(RegisteredInlineCompletionProvider {
|
||||||
_subscription: cx.observe(&provider, |this, _, cx| {
|
_subscription: cx.observe(&provider, |this, _, cx| {
|
||||||
|
if this.focus_handle.is_focused(cx) {
|
||||||
this.update_visible_inline_completion(cx);
|
this.update_visible_inline_completion(cx);
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
provider: Arc::new(provider),
|
provider: Arc::new(provider),
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user