Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add setting to disable completion docs
Juliaec4391b88e9a
diff --git a/assets/settings/default.json b/assets/settings/default.jsonindex 8fb73a2ecb0..8a3598eed11 100644--- a/assets/settings/default.json+++ b/assets/settings/default.json@@ -50,6 +50,9 @@// Whether to pop the completions menu while typing in an editor without// explicitly requesting it."show_completions_on_input": true,+ // Whether to display inline and alongside documentation for items in the+ // completions menu+ "show_completion_documentation": true,// Whether to show wrap guides in the editor. Setting this to true will// show a guide at the 'preferred_line_length' value if softwrap is set to// 'preferred_line_length', and will show any additional guides as specifieddiff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 1a17f38f92a..bb6d693d825 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -1000,6 +1000,11 @@ impl CompletionsMenu {project: Option<ModelHandle<Project>>,cx: &mut ViewContext<Editor>,) {+ let settings = settings::get::<EditorSettings>(cx);+ if !settings.show_completion_documentation {+ return;+ }+let Some(project) = project else {return;};@@ -1083,6 +1088,11 @@ impl CompletionsMenu {project: Option<&ModelHandle<Project>>,cx: &mut ViewContext<Editor>,) {+ let settings = settings::get::<EditorSettings>(cx);+ if !settings.show_completion_documentation {+ return;+ }+let completion_index = self.matches[self.selected_item].candidate_id;let Some(project) = project else {return;@@ -1241,6 +1251,9 @@ impl CompletionsMenu {) -> AnyElement<Editor> {enum CompletionTag {}+ let settings = settings::get::<EditorSettings>(cx);+ let show_completion_documentation = settings.show_completion_documentation;+let widest_completion_ix = self.matches.iter()@@ -1252,7 +1265,9 @@ impl CompletionsMenu {let mut len = completion.label.text.chars().count();if let Some(Documentation::SingleLine(text)) = documentation {- len += text.chars().count();+ if show_completion_documentation {+ len += text.chars().count();+ }}len@@ -1273,7 +1288,12 @@ impl CompletionsMenu {let item_ix = start_ix + ix;let candidate_id = mat.candidate_id;let completion = &completions_guard[candidate_id];- let documentation = &completion.documentation;++ let documentation = if show_completion_documentation {+ &completion.documentation+ } else {+ &None+ };items.push(MouseEventHandler::new::<CompletionTag, _>(diff --git a/crates/editor/src/editor_settings.rs b/crates/editor/src/editor_settings.rsindex b06f23429a1..75f8b800f93 100644--- a/crates/editor/src/editor_settings.rs+++ b/crates/editor/src/editor_settings.rs@@ -7,6 +7,7 @@ pub struct EditorSettings {pub cursor_blink: bool,pub hover_popover_enabled: bool,pub show_completions_on_input: bool,+ pub show_completion_documentation: bool,pub use_on_type_format: bool,pub scrollbar: Scrollbar,pub relative_line_numbers: bool,@@ -33,6 +34,7 @@ pub struct EditorSettingsContent {pub cursor_blink: Option<bool>,pub hover_popover_enabled: Option<bool>,pub show_completions_on_input: Option<bool>,+ pub show_completion_documentation: Option<bool>,pub use_on_type_format: Option<bool>,pub scrollbar: Option<ScrollbarContent>,pub relative_line_numbers: Option<bool>,