Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

vim: Fix inline completions not disappearing in normal mode (#23176)

Thorsten Ballbf75b3346450
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 81938bbe879..119f97259d7 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -1732,8 +1732,12 @@ impl Editor {
self.input_enabled = input_enabled;
}
- pub fn set_inline_completions_enabled(&mut self, enabled: bool) {
+ pub fn set_inline_completions_enabled(&mut self, enabled: bool, cx: &mut ViewContext<Self>) {
self.enable_inline_completions = enabled;
+ if !self.enable_inline_completions {
+ self.take_active_inline_completion(cx);
+ cx.notify();
+ }
}
pub fn set_autoindent(&mut self, autoindent: bool) {
@@ -4785,6 +4789,7 @@ impl Editor {
|| (!self.completion_tasks.is_empty() && !self.has_active_inline_completion()));
if completions_menu_has_precedence
|| !offset_selection.is_empty()
+ || !self.enable_inline_completions
|| self
.active_inline_completion
.as_ref()
diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs
index d8a58e47893..4553cf71029 100644
--- a/crates/vim/src/vim.rs
+++ b/crates/vim/src/vim.rs
@@ -1240,7 +1240,7 @@ impl Vim {
.map_or(false, |provider| provider.show_completions_in_normal_mode()),
_ => false,
};
- editor.set_inline_completions_enabled(enable_inline_completions);
+ editor.set_inline_completions_enabled(enable_inline_completions, cx);
});
cx.notify()
}