editor: Add support for no auto-indent on enter#47751
editor: Add support for no auto-indent on enter#47751MrSubidubi merged 8 commits intozed-industries:mainfrom
Conversation
When `auto_indent` is set to false, pressing Enter on an indented line no longer copies the indentation to the new line.
MrSubidubi
left a comment
There was a problem hiding this comment.
Thanks for this!
I see the use-case for this, however, this is the first complaint that we have had for this feature and I do not think this should be an on-off swich.
Can we instead refactor this setting to be an enum that holds these three variants, add/modify a settings migration for that and then go with that route?
- `full`: Adjusts indentation based on syntax context (previous `true`) - `preserve_indent`: Preserves current line's indentation on new lines - `none`: No automatic indentation (previous `false`) Includes settings migration and UI dropdown renderer.
auto_indent from a boolean to an enum with three modes:
Done! |
auto_indent from a boolean to an enum with three modes:auto_indent from a boolean to an enum with three modes
MrSubidubi
left a comment
There was a problem hiding this comment.
Two minor questions, otherwise looks good!
|
Also see #47545 (comment) (and particularly the questions in the discussion's description) |
|
I'm fixing the conflicts now - noticed them after re-requesting the review 😅 |
# Conflicts: # crates/migrator/src/migrations.rs # crates/migrator/src/migrator.rs
auto_indent from a boolean to an enum with three modes
MrSubidubi
left a comment
There was a problem hiding this comment.
Sorry for the delay, was out sick. Looks good, thanks!
|
FYI, the release note is incorrect. The new default setting is Also, I think breaking changes should be put at the top of the release notes, not at the very bottom lol. |
|
@injust Ah sorry, I forgot to update the release notes here as we decided on a different naming during the PR. Not sure how this is a breaking change though? |
Oh, I guess it isn't. But it's in that section at the bottom, anyway. |
|
Reached out to Joseph and asked about whether we can update the release notes at least partially, so thanks for pointing that out. |
|
Well spotted @injust, I forgot about updating it as well |
Closes #47550
Changes the
auto_indentsetting from a boolean to an enum with three modes:syntax_aware(default): Adjusts indentation based on syntax context when typing (previoustruebehavior)preserve_indent: Preserves the current line's indentation on new lines, but doesn't adjust based on syntaxnone: No automatic indentation - new lines start at column 0 (previousfalsebehavior)This gives users more control over indentation behavior. Previously, setting
auto_indent: falsewould still preserve indentation on new lines, which was unexpected.Includes:
Release Notes:
auto_indentsetting from boolean to enum withsyntax_aware,preserve_indent, andnoneoptions