summaryrefslogtreecommitdiffhomepage
path: root/data
diff options
context:
space:
mode:
authorŁukasz Gołębiewski <lukasz.golebiewski@gmail.com>2020-01-23 17:43:04 +0100
committerGitHub <noreply@github.com>2020-01-23 17:43:04 +0100
commit8065c3c074719bd13db67b5ec74db560609a4e64 (patch)
treeb4cd6715cd196eecabe488caaab6b9a24ab637a1 /data
parent1a869950eba47e30ebe84e118f404ef9a62e9cc6 (diff)
downloadstylish-haskell-8065c3c074719bd13db67b5ec74db560609a4e64.tar.gz
Support for records formatting (#256)
* Initial test describing simplest scenario for Data step Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * [sanity-check] Delete data defs * Extract changeDecl Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * First green test :-) * Cover case where there are more then one field in data type declaration Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * Add case03 where a type variable is present * Add case04 - multiple declarations * Make case04 pass * Extend tests with case05 Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * Add pending case06 Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * Fix case 06 Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * Add case07 Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * Add second phantom case * Add records to config * Make indent size configurable for records Co-authored-by: Paweł Szulc <paul.szulc@gmail.com> * Fix warnings in Data.hs * Process derivings during record formatting Co-authored-by: Paweł Szulc <paul.szulc@gmail.com> * Do not format when context is present Co-authored-by: Paweł Szulc <paul.szulc@gmail.com> * Add case 11 - deriving with DerivingStrategies * Bugfix: do not remove empty data declarations Co-authored-by: Paweł Szulc <paul.szulc@gmail.com> * Update README example with ability to format records * Add case12 (Point) * Fix case 12 * Factor out processName * Apply hlint suggestions * Extract constructors helper function * Make 'indent' global * Remove unused Stylish.records method * Fix Config formatting in Config.hs * Extract processConstructor function Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * Refactor datas function Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * Include comments with AST. Two tests are still failing... * Fix cases 15 and 16 * Do not format records when comments within Co-authored-by: Łukasz Gołębiewski <lukasz.golebiewski@gmail.com> * Clean-up Data.hs * Refactor Data.hs Co-authored-by: Pawel Szulc <paul.szulc@gmail.com>
Diffstat (limited to 'data')
-rw-r--r--data/stylish-haskell.yaml6
1 files changed, 6 insertions, 0 deletions
diff --git a/data/stylish-haskell.yaml b/data/stylish-haskell.yaml
index 2a17cb5..209d613 100644
--- a/data/stylish-haskell.yaml
+++ b/data/stylish-haskell.yaml
@@ -15,6 +15,9 @@ steps:
# # true.
# add_language_pragma: true
+ # Format record definitions
+ - records: {}
+
# Align the right hand side of some elements. This is quite conservative
# and only applies to statements where each element occupies a single
# line. All default to true.
@@ -222,6 +225,9 @@ steps:
# simple_align but is a bit less conservative.
# - squash: {}
+# A common indentation setting. Different steps take this into account.
+indent: 4
+
# A common setting is the number of columns (parts of) code will be wrapped
# to. Different steps take this into account.
#