Fix two auto-indent issues with Markdown and YAML (#20193)

Closes #13376
Closes #13338

Release Notes:

- Fixed unhelpful auto-indent suggestions in markdown.
- Added `auto_indent_on_paste` setting, which can be used on a
per-language basis, to configure whether indentation should be adjusted
when pasting. This setting is enabled by default for languages other
than YAML and Markdown.
This commit is contained in:
Max Brunsfeld 2024-11-04 12:29:38 -08:00 committed by GitHub
parent cfcbfc1d82
commit 4d3a18cbdc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 29 additions and 3 deletions

View file

@ -125,6 +125,8 @@ pub struct LanguageSettings {
/// 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,
/// Whether indentation of pasted content should be adjusted based on the context.
pub auto_indent_on_paste: bool,
// Controls how the editor handles the autoclosed characters.
pub always_treat_brackets_as_autoclosed: bool,
/// Which code actions to run on save
@ -360,6 +362,10 @@ pub struct LanguageSettingsContent {
///
/// Default: true
pub linked_edits: Option<bool>,
/// Whether indentation of pasted content should be adjusted based on the context.
///
/// Default: true
pub auto_indent_on_paste: Option<bool>,
/// Task configuration for this language.
///
/// Default: {}
@ -1132,6 +1138,7 @@ fn merge_settings(settings: &mut LanguageSettings, src: &LanguageSettingsContent
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.auto_indent_on_paste, src.auto_indent_on_paste);
merge(
&mut settings.always_treat_brackets_as_autoclosed,
src.always_treat_brackets_as_autoclosed,