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

Fix Fourmolu 0.7 support #2950

Merged
merged 3 commits into from
Jun 13, 2022
Merged

Fix Fourmolu 0.7 support #2950

merged 3 commits into from
Jun 13, 2022

Conversation

georgefst
Copy link
Collaborator

No description provided.

Fourmolu 0.7 (due to Ormolu 0.5) removes the `--cabal-default-extensions` flag, instead looking for Cabal files by default. If input is taken from stdin and `--stdin-input-file` isn't specified, it therefore fails.

We don't need to make any changes in non-CLI mode because the Cabal file handling logic occurs at a higher level outside the entry point we use to the library (the `ormolu` function).
This was referenced Jun 12, 2022
@georgefst georgefst requested a review from jneira as a code owner June 12, 2022 14:47
@georgefst georgefst force-pushed the fourmolu-0.7-fixes branch 2 times, most recently from 82edbca to 0bbc545 Compare June 12, 2022 16:57
@georgefst georgefst changed the title Fourmolu fixes Fix Fourmolu 0.7 support Jun 12, 2022
@@ -66,7 +66,7 @@ provider plId ideState typ contents fp fo = withIndefiniteProgress title Cancell
(exitCode, out, err) <-
readCreateProcessWithExitCode
( proc "fourmolu" $
["-d"]
["-d", "--no-cabal"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, here's a reason for the "compile against the package" approach: we don't have a sane way of knowing whether or not to pass this flag, since it depends on which CLI version the user has installed!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have a sane way of knowing whether or not to pass this flag

Sane or not, fixed in 581686c.

(CLI mode isn't enabled by default, so I'm not too concerned about any weirdness)

{ noCabal = v >= ["0", "7"]
}
Nothing -> do
T.hPutStrLn stderr "couldn't get Fourmolu version"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bad error reporting, but I'm about to revamp the logging for the whole plugin anyway, since I've been told off by @fendor for printing directly to stdout!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you going to tidy up the logging in this PR or later? Otherwise LGTM.

@georgefst georgefst enabled auto-merge June 13, 2022 13:21
@georgefst
Copy link
Collaborator Author

georgefst commented Jun 13, 2022

Are you going to tidy up the logging in this PR or later? Otherwise LGTM.

Later, but hopefully today.

@georgefst georgefst merged commit 8a5840a into master Jun 13, 2022
@georgefst
Copy link
Collaborator Author

There are some weird things going on with CI.

This PR appeared to be failing for a while, with some impenetrable error in one of the post-job tests. But that somehow sorted itself out without any intervention.

And then, after merging, there's this failure.

@michaelpj
Copy link
Collaborator

It seemed like it was stuck, so I restarted some jobs, that's why!

@georgefst
Copy link
Collaborator Author

Aha, thanks, I thought I was going mad.

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

Successfully merging this pull request may close these issues.

2 participants