Skip to content

Introduce purs-tidy formatter #126

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

Merged
merged 5 commits into from
Nov 19, 2021
Merged

Introduce purs-tidy formatter #126

merged 5 commits into from
Nov 19, 2021

Conversation

thomashoneyman
Copy link
Contributor

Description of the change
Introduces the purs-tidy formatter. This formatter is a lightly opinionated tool we use to maintain a consistent style in the contrib libraries.

We ordinarily restrict to tools provided by the core or contrib projects. This tool is not, but it was developed and is maintained by core team members, and because it's a formatter it can't block maintenance or release of this library even in the event something goes catastrophically wrong with it.


Checklist:

  • Added the change to the changelog's "Unreleased" section with a link to this PR and your username
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation in the README and/or documentation directory
  • Added a test for the contribution (if applicable)

@@ -77,52 +76,66 @@ type LanguageDef = GenLanguageDef String Identity
-- | features of the "Text.Parsec.Token" module. The module `Text.Parsec.Language`
-- | contains some default definitions.
newtype GenLanguageDef s m
= LanguageDef {
= LanguageDef
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@natefaubion This one is a bit weird; ideally, the commas would be lined up with the values in the record themselves, though I understand that the original formatting with trailing commas is the cause of the issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

The formatter doesn’t relocate comments to other tokens. In fact, it tried to preserve it as much as possible. That’s why it keeps the newline after the comma, so that the comment is preserved as a leading comment on that token, and not relocated to a trailing comment on the comma.

Copy link
Contributor

@JordanMartinez JordanMartinez left a comment

Choose a reason for hiding this comment

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

This was a rough diff in the Token.purs file. LGTM AFAICT.


-- | Describes the end of a block comment. Use the empty string if the
-- | language doesn't support block comments. For example `*/`.
, commentEnd :: String
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@natefaubion It'd be nice if the comments could align with the identifier, not the comma -- thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Comments align to the token they are attached to.

Copy link
Contributor

Choose a reason for hiding this comment

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

Due to the comma, will these constructors have documentation once docs are pushed to Pursuit?

@thomashoneyman thomashoneyman merged commit c9b486e into main Nov 19, 2021
@thomashoneyman thomashoneyman deleted the trh/purs-tidy branch November 19, 2021 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants