Skip to content

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

Merged
eemeli merged 1 commit intomasterfrom
compact-props
Nov 20, 2022
Merged

Use indicator line for props on block collection values of mappings#425
eemeli merged 1 commit intomasterfrom
compact-props

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