Fix use_on_type_format
setting being unused per language (#18387)
Before this change, `use_on_type_format` would only have an effect when defined on a global level in our settings. But our default.json settings would also document that it's used in language settings, i.e.: ```json { "languages": { "C": { "use_on_type_format": false }, "C++": { "use_on_type_format": false } } } ``` But this did **not** work. With the change, it now works globally and per-language. Release Notes: - Fixed `use_on_type_format` setting not working when defined inside `"languages"` in the settings. This change will now change the default behavior for C, C++, and Markdown, by turning language server's `OnTypeFormatting` completions off by default. Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
parent
140d70289e
commit
3f415f3587
3 changed files with 19 additions and 7 deletions
|
@ -113,6 +113,9 @@ pub struct LanguageSettings {
|
|||
pub use_autoclose: bool,
|
||||
/// Whether to automatically surround text with brackets.
|
||||
pub use_auto_surround: bool,
|
||||
/// Whether to use additional LSP queries to format (and amend) the code after
|
||||
/// every "trigger" symbol input, defined by LSP server capabilities.
|
||||
pub use_on_type_format: bool,
|
||||
// Controls how the editor handles the autoclosed characters.
|
||||
pub always_treat_brackets_as_autoclosed: bool,
|
||||
/// Which code actions to run on save
|
||||
|
@ -333,6 +336,11 @@ pub struct LanguageSettingsContent {
|
|||
///
|
||||
/// Default: false
|
||||
pub always_treat_brackets_as_autoclosed: Option<bool>,
|
||||
/// Whether to use additional LSP queries to format (and amend) the code after
|
||||
/// every "trigger" symbol input, defined by LSP server capabilities.
|
||||
///
|
||||
/// Default: true
|
||||
pub use_on_type_format: Option<bool>,
|
||||
/// Which code actions to run on save after the formatter.
|
||||
/// These are not run if formatting is off.
|
||||
///
|
||||
|
@ -1045,6 +1053,7 @@ fn merge_settings(settings: &mut LanguageSettings, src: &LanguageSettingsContent
|
|||
merge(&mut settings.soft_wrap, src.soft_wrap);
|
||||
merge(&mut settings.use_autoclose, src.use_autoclose);
|
||||
merge(&mut settings.use_auto_surround, src.use_auto_surround);
|
||||
merge(&mut settings.use_on_type_format, src.use_on_type_format);
|
||||
merge(
|
||||
&mut settings.always_treat_brackets_as_autoclosed,
|
||||
src.always_treat_brackets_as_autoclosed,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue