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

@ -591,6 +591,9 @@ pub struct LanguageConfig {
/// the indentation level for a new line.
#[serde(default = "auto_indent_using_last_non_empty_line_default")]
pub auto_indent_using_last_non_empty_line: bool,
// Whether indentation of pasted content should be adjusted based on the context.
#[serde(default)]
pub auto_indent_on_paste: Option<bool>,
/// A regex that is used to determine whether the indentation level should be
/// increased in the following line.
#[serde(default, deserialize_with = "deserialize_regex")]
@ -718,6 +721,7 @@ impl Default for LanguageConfig {
matcher: LanguageMatcher::default(),
brackets: Default::default(),
auto_indent_using_last_non_empty_line: auto_indent_using_last_non_empty_line_default(),
auto_indent_on_paste: None,
increase_indent_pattern: Default::default(),
decrease_indent_pattern: Default::default(),
autoclose_before: Default::default(),