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

Always float comments to the top of field values #87

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

tfausak
Copy link
Owner

@tfausak tfausak commented Jun 19, 2024

Fixes #70.

Previously Gild would only float comments to the top of a field if Gild knew how to parse the field (like build-depends) and the field parsed successfully. Otherwise Gild would leave the comments where they were (although it would re-indent them). Now Gild will always pull all comments up to the top of a field, regardless of if Gild knows how to parse the field or if the parsing succeeded.

This is a change in behavior. Hopefully it's easier for users to understand how Gild behaves.

Before:

some-field:
  foo
  -- bar
  qux

After:

some-field:
  -- bar
  foo
  qux

In the future, it's possible that Gild will make an effort to keep comments where they were. However in general this is a difficult problem and in some cases it doesn't have a clear answer. So for now this predictable behavior is preferable.

@tfausak tfausak merged commit ba8b2e5 into main Jun 19, 2024
10 checks passed
@tfausak tfausak deleted the gh-70-float-comments branch June 19, 2024 17:35
@tfausak tfausak added bug Something isn't working enhancement New feature or request labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comments inside ghc-options are not preserved properly
1 participant