Allow to disable the new feature

This commit is contained in:
Kirill Bulatov 2023-05-23 17:50:50 +03:00
parent b9dabb165e
commit d1f4b60fa1
3 changed files with 6 additions and 1 deletions

View File

@ -39,6 +39,9 @@
// Whether to pop the completions menu while typing in an editor without
// explicitly requesting it.
"show_completions_on_input": true,
// Whether to use additional LSP queries to format (and amend) the code after
// every "trigger" symbol input, defined by LSP server capabilities.
"use_on_type_format": true,
// Controls whether copilot provides suggestion immediately
// or waits for a `copilot::Toggle`
"show_copilot_suggestions": true,

View File

@ -2123,7 +2123,7 @@ impl Editor {
this.change_selections(Some(Autoscroll::fit()), cx, |s| s.select(new_selections));
// When buffer contents is updated and caret is moved, try triggering on type formatting.
if text.len() == 1 {
if settings::get::<EditorSettings>(cx).use_on_type_format && text.len() == 1 {
let input_char = text.chars().next().expect("single char input");
if let Some(on_type_format_task) = this.trigger_on_type_format(input_char, cx) {
on_type_format_task.detach_and_log_err(cx);

View File

@ -7,6 +7,7 @@ pub struct EditorSettings {
pub cursor_blink: bool,
pub hover_popover_enabled: bool,
pub show_completions_on_input: bool,
pub use_on_type_format: bool,
pub scrollbar: Scrollbar,
}
@ -30,6 +31,7 @@ pub struct EditorSettingsContent {
pub cursor_blink: Option<bool>,
pub hover_popover_enabled: Option<bool>,
pub show_completions_on_input: Option<bool>,
pub use_on_type_format: Option<bool>,
pub scrollbar: Option<ScrollbarContent>,
}