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

Display fourmolu version information #3255

Closed
pgrange opened this issue Oct 6, 2022 · 5 comments
Closed

Display fourmolu version information #3255

pgrange opened this issue Oct 6, 2022 · 5 comments
Labels

Comments

@pgrange
Copy link

pgrange commented Oct 6, 2022

Is your feature request related to a problem? Please describe.

I can't find which version of fourmolu is used by vscode-haskell to ensure it matches others tools/CI/peers version.

I've observed breaking changes in fourmolu version 0.5.0 in some haddock indentation.

When indenting with fourmolu 0.4.0 I get one formatting.

When indenting with fourmolu 0.6.0 I get another formatting.

When indent with fourmolu inside vscode using vscode-haskell extension version 2.2.1 I get another formatting.

I can't find out the version of fourmolu that is being used by vscode-haskell so that I may use it as a "standard" version for instance.

Describe the solution you'd like

Display version of fourmolu used.

In the short term, I would be interested by just having the answer here for vscode-haskell 2.2.1.

In a longer term, display this information, for instance in Haskell: Formatting Provider preference drop-down list.

Describe alternatives you've considered

Add the Formatting provider versions in CHANGELOG

Additional context

No additional context.

@fendor
Copy link
Collaborator

fendor commented Oct 6, 2022

Hi!

The version of fourmolu depends on your HLS version, where you got it from, etc... So, we can't answer the question right away what fourmolu version vscode-haskell is using.

It is also not vscode-haskell's responsibility to print the formatter version used, but the responsibility of HLS. Transferring the issue.

You might be interested to instruct HLS to use the fourmolu binary HLS finds on the PATH instead of the one directly linked into HLS.

@fendor fendor transferred this issue from haskell/vscode-haskell Oct 6, 2022
@michaelpj
Copy link
Collaborator

Another casualty of #411 IMO

@georgefst
Copy link
Collaborator

georgefst commented Oct 7, 2022

You might be interested to instruct HLS to use the fourmolu binary HLS finds on the PATH instead of the one directly linked into HLS.

Unfortunately, I'm still not sure if this is possible (and I wrote the patch!): #2827. I'm looking in to finally solving that now.

@jhrcek
Copy link
Collaborator

jhrcek commented Nov 14, 2022

For people who want to have specific version of fourmolu built into hls.
You can build hls from source using ghcup, specifying version constraint on fourmolu like this:

ghcup compile hls -g master --ghc 9.2.4 --cabal-update -- --constraint="fourmolu==0.6.0.0"

this compiles haskell-language-server from master branch of it's repo using ghc 9.2.4 (= hls has to be compiled with the same version of ghc that your project is using). --cabal-update tells ghcup to tell caball to fetch latest version of packages from hackage. --constraint flag is forwarded by ghcup to cabal, which then uses specific version of fourmolu in cabal plan. Might not work with all versions of ghc, didn't check. But it works with 9.2.4

@michaelpj
Copy link
Collaborator

You can now see the version by running haskell-language-server --list-plugins, which I think is as good as we can do.

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

No branches or pull requests

5 participants