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

Add import and module support #124

Merged
merged 26 commits into from Mar 21, 2018

Conversation

Projects
None yet
5 participants
@lspitzner
Owner

lspitzner commented Mar 12, 2018

#83 got closed due to me deleting the dev branch, so I now reopen it, including several finishing touches.

I am planning to merge this and make a new release with it in the next days. Again, sorry for the long hold-up, but fixing the low-level bug (see below) took a good bit of time and this caused me to put this off again and again.

In addition to what was last added to #83, this branch also contains the following changes:

  • Merge in current master

  • Fix bug in lower-level parts of brittany that led to discarding certain alternatives with the IEThingWith layouters. See af7f901, which is a one-liner fix, that nonetheless was rather time-consuming to diagnose.

  • Prevent hanging indent for IEThingWith. This is a bugfix for the IndentPolicyLeft case and an opinionated improvement otherwise:

    -- hanging indent:
    import Test
      ( Long( List
            , Of
            , Things
            ) )
    -- fixed version:
    import Test
      ( Long
        ( List
        , Of
        , Things
        )
      )
  • Retain empty lines before the module keyword that previously got eaten. Added a new BriDoc constructor just for this.

  • Add config options _lconfig_reformatModulePreamble and _lconfig_allowSingleLineExportList (defaults True and False). The former can disable preamble formatting if desired. The latter is again the question of consistency - I like my exports in separate line even if it is just one short thingy. I was so arrogant to set the default according to my preference.

  • Change _lconfig_importColumn default from 60 to 50, as was discussed in #83. I have left the test-config as-is (at 60) because I am lazy.

sniperrifle2004 and others added some commits Dec 16, 2017

Also fix export comments
Also refactored a little to improve reuse of the docWrapNode logic
Refactor a bit more
- remove unnecessary docWrapNodeRest
- make sure that sharing is correct and non-redundant
Add compact version of import layout
Also let layoutLLIEs deal with comments
Fix Alt-transformation bug with BDFEnsureIndents
multiple BDFEnsureIndent nodes were mistreated previously
Stop hanging indent for IEThingWith
plus minor refactors/cleanups

this is more in line with IndentPolicyLeft and imo also looks
nicer in general
Improve module layouting in two aspects
- IEThingWith in export list can now be single-line
- Now respect offset of the "module" keyword
  (retain empty lines after pragmas, for example)
@tfausak

This comment has been minimized.

Collaborator

tfausak commented Mar 12, 2018

🎉 Looks great!

cc @sniperrifle2004

@lspitzner lspitzner referenced this pull request Mar 12, 2018

Closed

Format imports #492

@matthew-piziak

This comment has been minimized.

Contributor

matthew-piziak commented Mar 20, 2018

Is anything blocking this PR?

@lspitzner

This comment has been minimized.

Owner

lspitzner commented Mar 21, 2018

Well there is this minor-feature request, which I implemented just now.

But that made me notice this:

#test long-module-name-hiding-items
import           TestJustShortEnoughModuleNameLike hiding ( abc
                                                          , def
                                                          , ghci
                                                          , jklm
                                                          )
import           TestJustAbitToLongModuleNameLikeTh
                                                   hiding ( abc
                                                          , def
                                                          , ghci
                                                          , jklm
                                                          )

currently gives

import           TestJustShortEnoughModuleNameLike hiding ( abc
                                                   , def
                                                   , ghci
                                                   , jklm
                                                   )
import           TestJustAbitToLongModuleNameLikeTh
                                                   hiding ( abc
                                                   , def
                                                   , ghci
                                                   , jklm
                                                   )
@lspitzner

This comment has been minimized.

Owner

lspitzner commented Mar 21, 2018

I'll merge anyway, this feature branch has lived long enough. Presuming the CI comes out green. There will be minor stuff to fix anyway in the future I guess.

@lspitzner lspitzner merged commit 8de56ba into master Mar 21, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@matthew-piziak

This comment has been minimized.

Contributor

matthew-piziak commented Mar 21, 2018

🎉

@lspitzner lspitzner deleted the import branch Mar 21, 2018

@domenkozar

This comment has been minimized.

domenkozar commented Mar 23, 2018

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment