Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use indicator line for props on block collection values of mappings #425

Merged
merged 1 commit into from
Nov 20, 2022

Conversation

eemeli
Copy link
Owner

@eemeli eemeli commented Nov 13, 2022

Fixes #399

When stringifying a block collection inside a block mapping, the results look nicer if any anchor or tag on the inner collection are placed on the same line as the : indicator.

To effect this, it turns out to be necessary to do a bit of re-parsing of the stringified inner value to determine if it has a leading "props line" or not. In almost all cases, this is limited to looking at the first character of the output, so the performance implications should be negligible esp. as it was already necessary to find the position of the first \n in the output.

The changes made here also alter the indentation of leading comments of block sequence values to match the - indicator column, rather than the value column.

@eemeli eemeli merged commit 5e5470a into master Nov 20, 2022
@eemeli eemeli deleted the compact-props branch November 20, 2022 11:51
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.

Custom tags are printed on newline instead of after the key
1 participant