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

toml: allow inline comments in multiline arrays #624

Merged

Conversation

pjjw
Copy link
Contributor

@pjjw pjjw commented Sep 9, 2023

previously, if you had comments on individual items in a multiline
array, e.g.

children = [
  "michael",
  "gob", # i don't care too much for this one
  "lindsay",
]

topiary would confusingly move the comment below the element it was
placed next to-

children = [
  "michael",
  "gob",
  # i don't care too much for this one
  "lindsay",
]

which can destroy the intent of the comment. this rule update now
preserves inline comments and won't insert a linebreak after a separator
if followed by one.

@pjjw pjjw marked this pull request as ready for review September 9, 2023 09:01
topiary/tests/samples/expected/toml.toml Show resolved Hide resolved
topiary/tests/samples/input/toml.toml Show resolved Hide resolved
topiary/languages/toml.scm Outdated Show resolved Hide resolved
previously, if you had comments on individual items in a multiline
array, e.g.

```toml
children = [
  "michael",
  "gob", # i don't care too much for this one
  "lindsay",
]
```

topiary would confusingly move the comment _below_ the element it was
placed next to-

```toml
children = [
  "michael",
  "gob",
  # i don't care too much for this one
  "lindsay",
]
```
which can destroy the intent of the comment. this rule update now
preserves inline comments and won't insert a linebreak after a separator
if followed by one.
@pjjw pjjw force-pushed the pjjw/toml-allow-multiline-array-inline-comments branch from 0d22c01 to 12fb7e1 Compare September 14, 2023 10:09
@pjjw
Copy link
Contributor Author

pjjw commented Sep 14, 2023

@nbacquey thanks for the pointers! let me know if i've addressed comments to satisfaction.

Copy link
Member

@nbacquey nbacquey left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for contributing!

@nbacquey nbacquey merged commit 2b4d05d into tweag:main Sep 14, 2023
1 check passed
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.

2 participants