Skip to content

Fix indent on enter for nested maps#1252

Merged
datho7561 merged 1 commit into
redhat-developer:mainfrom
datho7561:fix-indentation-on-enter
May 15, 2026
Merged

Fix indent on enter for nested maps#1252
datho7561 merged 1 commit into
redhat-developer:mainfrom
datho7561:fix-indentation-on-enter

Conversation

@datho7561
Copy link
Copy Markdown
Contributor

What does this PR do?

  • Fixes indent on enter for nested maps
  • Simplify code so that it adds or removes spaces based on what's already present instead of completely replacing it

What issues does this PR fix or reference?

Fixes redhat-developer/vscode-yaml#1226

Is it tested? How?

Modified existing unit tests and added new ones for the nested cases

- Simplify code so that it adds or removes spaces based on what's already
  present instead of completely replacing it

Fixes redhat-developer/vscode-yaml#1226

Signed-off-by: David Thompson <davthomp@redhat.com>
Copy link
Copy Markdown
Member

@shin19991207 shin19991207 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't reproduce the issue on my end but the code looks good to me!

@datho7561
Copy link
Copy Markdown
Contributor Author

Wait, really? Hmm, I'll double check before and after on my Mac locally before merging.

@datho7561
Copy link
Copy Markdown
Contributor Author

I think maybe it's not on by default, I had to add "editor.formatOnType": true, then the bug appeared. Otherwise I wasn't getting any auto indentation, which seemed weird to me, since I thought that the TextMate grammar normally provides that.

@datho7561 datho7561 merged commit ff2c8ea into redhat-developer:main May 15, 2026
4 checks passed
@datho7561 datho7561 deleted the fix-indentation-on-enter branch May 15, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pressing return after colon indents a single space

2 participants