Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Revert "vim: Don't show inline completions in normal mode (#17137)" (#17138)
Thorsten Ball820ad488e426
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex a4306297fec..ce6349b203d 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -470,9 +470,6 @@ struct BufferOffset(usize);// Addons allow storing per-editor state in other crates (e.g. Vim)pub trait Addon: 'static {fn extend_key_context(&self, _: &mut KeyContext, _: &AppContext) {}- fn should_show_inline_completions(&self, _: &AppContext) -> bool {- true- }fn to_any(&self) -> &dyn std::any::Any;}@@ -2343,11 +2340,6 @@ impl Editor {cx: &AppContext,) -> bool {if let Some(provider) = self.inline_completion_provider() {- for addon in self.addons.values() {- if !addon.should_show_inline_completions(cx) {- return false;- }- }if let Some(show_inline_completions) = self.show_inline_completions_override {show_inline_completions} else {diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rsindex ab280774870..d7015440f46 100644--- a/crates/vim/src/vim.rs+++ b/crates/vim/src/vim.rs@@ -91,7 +91,8 @@ pub fn init(cx: &mut AppContext) {VimSettings::register(cx);VimGlobals::register(cx);- cx.observe_new_views(Vim::register).detach();+ cx.observe_new_views(|editor: &mut Editor, cx| Vim::register(editor, cx))+ .detach();cx.observe_new_views(|workspace: &mut Workspace, _| {workspace.register_action(|workspace, _: &ToggleVimMode, cx| {@@ -134,11 +135,6 @@ impl editor::Addon for VimAddon {self.view.read(cx).extend_key_context(key_context)}- fn should_show_inline_completions(&self, cx: &AppContext) -> bool {- let mode = self.view.read(cx).mode;- mode == Mode::Insert || mode == Mode::Replace- }-fn to_any(&self) -> &dyn std::any::Any {self}