Skip to content

Fix inconsistent comment indentation in parameter lists#346

Merged
jfly merged 1 commit intoNixOS:masterfrom
dyegoaurelio:incosistent-param-last-comment
Oct 18, 2025
Merged

Fix inconsistent comment indentation in parameter lists#346
jfly merged 1 commit intoNixOS:masterfrom
dyegoaurelio:incosistent-param-last-comment

Conversation

@dyegoaurelio
Copy link
Copy Markdown
Contributor

Addresses inconsistent indentation of comments after the last parameter in function parameter lists.

Comments following all parameters were incorrectly indented one level less than comments between parameters.

Fixes #337

Addresses inconsistent indentation of comments after the last parameter
in function parameter lists. Comments following all parameters were
incorrectly indented one level less than comments between parameters.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 18, 2025

Nixpkgs diff

Copy link
Copy Markdown
Contributor

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

This LGTM, thanks! But I don't understand the actual Haskell change, so take my approval with a grain of salt.

I'd appreciate being educated though, if anyone has the patience. See my comment below.

Aside: the nixpkgs diff highlights a few instances of commented out destructured params that should be updated to the new formatting style.

Comment on lines -353 to +354
<> pretty bclose
<> nest (pretty (preTrivia bclose))
<> pretty (bclose{preTrivia = []})
Copy link
Copy Markdown
Contributor

@MattSturgeon MattSturgeon Oct 18, 2025

Choose a reason for hiding this comment

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

I don't really understand this diff, or why we need to handle bclose twice; passing it to nest and then handling it again with preTrivia overridden.

Is preTrivia the indentation? Or perhaps the # prefix of the comment? What's the reason we can't just nest the comment without handling it twice?

EDIT: is blcose the closing brace, and preTrivia its attached comments?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exactly. So we're nesting the attached comments and formatting the rest of the token

Copy link
Copy Markdown
Collaborator

@jfly jfly left a comment

Choose a reason for hiding this comment

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

Thanks, @dyegoaurelio!

@jfly jfly merged commit e879231 into NixOS:master Oct 18, 2025
2 checks passed
@jfly
Copy link
Copy Markdown
Collaborator

jfly commented Oct 18, 2025

Aside: the nixpkgs diff highlights a few instances of commented out destructured params that should be updated to the new formatting style.

Love it! Fortunately, the diff looks small enough that I'm not nervous about this being painful to apply to nixpkgs.

@dyegoaurelio dyegoaurelio deleted the incosistent-param-last-comment branch October 18, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Inconsistent indentation of comments in function parameter list

3 participants