Skip to content
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
Merged

Add import and module support #124

merged 26 commits into from Mar 21, 2018

Conversation

@lspitzner
Copy link
Owner

@lspitzner 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 24 commits Dec 16, 2017
Also refactored a little to improve reuse of the docWrapNode logic
- remove unnecessary docWrapNodeRest
- make sure that sharing is correct and non-redundant
Also let layoutLLIEs deal with comments
multiple BDFEnsureIndent nodes were mistreated previously
plus minor refactors/cleanups

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

@tfausak tfausak commented Mar 12, 2018

🎉 Looks great!

cc @sniperrifle2004

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Mar 20, 2018

Is anything blocking this PR?

@lspitzner
Copy link
Owner Author

@lspitzner 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
Copy link
Owner Author

@lspitzner 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
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
lspitzner added a commit that referenced this pull request Mar 21, 2018
@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Mar 21, 2018

🎉

@lspitzner lspitzner deleted the import branch Mar 21, 2018
@domenkozar
Copy link

@domenkozar domenkozar commented Mar 23, 2018

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.