-
Notifications
You must be signed in to change notification settings - Fork 151
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 support for post qualified import formatting. #335
base: main
Are you sure you want to change the base?
Conversation
Adds an option to use post qualified module imports. Related to haskell#284 Resolves haskell#334
# | ||
# Default: false | ||
ghc_lib_parser: false |
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.
This ghc_lib_parser
option was removed since it is not used.
Not sure what the issue is with that mac build, classic case of "works on my machine". Not sure that I have access to rerun the build though, can someone with access trigger that for me (or show me how) ? |
This is exactly what I'm looking for right now. It seems like the build error is the same one I got on #337, @jaspervdj, could we ignore it again for this PR? |
hm, this seems to fail on post qualified explicit imports: import Data.Aeson qualified as JSON (Value) gives me:
I'll add a few failing test cases later today |
@@ -62,6 +62,9 @@ tests = testGroup "Language.Haskell.Stylish.Step.Imports.Tests" | |||
, testCase "case 28" case28 | |||
, testCase "case 29" case29 | |||
, testCase "case 30" case30 | |||
, testCase "case 31" case31 | |||
, testCase "case 32" case32 | |||
, testCase "case 33" case33 | |||
] |
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.
] | |
, testCase "case 34" case34 | |
, testCase "case 35" case35 | |
, testCase "case 36" case36 | |
, testCase "case 37" case37 | |
] |
, "" | ||
, "import Data.Foo (Foo (Bar, Foo), Goo (Goo))" | ||
, "import Data.Set (empty, intersect, nub)" | ||
] |
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.
] | |
] | |
-------------------------------------------------------------------------------- | |
case34 :: Assertion | |
case34 = assertSnippet (step Nothing defaultOptions {postQualified = True}) | |
[ "import qualified Data.Aeson as JSON (Value)" | |
] | |
[ "import Data.Aeson qualified as JSON (Value)" | |
] | |
-------------------------------------------------------------------------------- | |
case35 :: Assertion | |
case35 = assertSnippet (step Nothing defaultOptions {postQualified = True}) | |
[ "import Data.Aeson qualified as JSON (Value)" | |
] | |
[ "import Data.Aeson qualified as JSON (Value)" | |
] | |
-------------------------------------------------------------------------------- | |
case36 :: Assertion | |
case36 = assertSnippet (step Nothing defaultOptions {postQualified = True}) | |
[ "import qualified Data.Aeson as JSON (Value)" | |
, "import qualified Data.Aeson as JSON (encode, decode)" | |
] | |
[ "import Data.Aeson qualified as JSON (Value, decode, encode)" | |
] | |
-------------------------------------------------------------------------------- | |
case37 :: Assertion | |
case37 = assertSnippet (step Nothing defaultOptions {postQualified = True}) | |
[ "import Data.Aeson qualified as JSON (Value)" | |
, "import Data.Aeson qualified as JSON (encode, decode)" | |
] | |
[ "import Data.Aeson qualified as JSON (Value, decode, encode)" | |
] | |
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.
@jhmcstanton I've also added these changes as a PR to your branch, in case that's easier to work with
@jhmcstanton would it be much work now to rebase this against |
Adds an option to use post qualified module imports.
Related to #284
Resolves #334
Let me know if any more tests or changes are needed.