-
Notifications
You must be signed in to change notification settings - Fork 152
Support for records formatting #256
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
Support for records formatting #256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for the contribution!
data/stylish-haskell.yaml
Outdated
@@ -15,6 +15,10 @@ steps: | |||
# # true. | |||
# add_language_pragma: true | |||
|
|||
# Format record definitions | |||
- records: | |||
indent: 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would move the indent
setting to the top-level, just like columns
, so that other steps may possibly use this value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea :-) Done
Thanks for the review!
Co-authored-by: Łukasz Gołębiewski <[email protected]>
Co-authored-by: Łukasz Gołębiewski <[email protected]>
Co-authored-by: Łukasz Gołębiewski <[email protected]>
Co-authored-by: Łukasz Gołębiewski <[email protected]>
Co-authored-by: Łukasz Gołębiewski <[email protected]>
Co-authored-by: Łukasz Gołębiewski <[email protected]>
Co-authored-by: Łukasz Gołębiewski <[email protected]>
Co-authored-by: Paweł Szulc <[email protected]>
Co-authored-by: Paweł Szulc <[email protected]>
Co-authored-by: Paweł Szulc <[email protected]>
Co-authored-by: Paweł Szulc <[email protected]>
4dbc616
to
6e7547c
Compare
Hi @jaspervdj, is there anything else you would like us to do in this PR or is it ready to be merged? |
Co-authored-by: Łukasz Gołębiewski <[email protected]>
Co-authored-by: Łukasz Gołębiewski <[email protected]>
Hey @EncodePanda, the code looks good to me now; I just need to find some time to manually play with this, try it on a few larger codebases and then it's good to go in -- I promise I'll work on getting that done before the end of the week. |
Thanks for the review and the approve @jaspervdj ! |
Okay, great that you caught that! Another option you could consider is not formatting the data definition at all if there are any comments inside. |
Good idea @jaspervdj! Looks like for now we can do what you suggested only for Haddock style comments, due to how https://hackage.haskell.org/package/haskell-src-exts-1.23.0/docs/Language-Haskell-Exts-Comments.html#v:associateHaddock works Looks like the problem with comments being removed is more general (see #39) and probably needs to be solved in a separate PR |
Co-authored-by: Łukasz Gołębiewski <[email protected]>
We are almost there :) For now we will not format records that have comments in them but we have already a WIP that most likely will fix that (will arrive as a separate PR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👯♂
(Optionally) turns this:
into