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

Document corresponding versions for standalone tools (e.g., fourmolu) for binary releases #2649

Closed
tgiannak opened this issue Jan 29, 2022 · 8 comments
Labels
component: formatters type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. type: enhancement New feature or request

Comments

@tgiannak
Copy link

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

I use fourmolu both via the language server and as a standalone tool in my CI process. When the versions differ, sometimes the behavior does too, which results in the CI checks failing even though everything looks OK according to the language server. This was especially surprising with today's 1.6.0.0 release, which I had expected would be built against fourmolu 0.5.0.1. (Whatever version is included in the language server differs in its behavior with respect to Haddock comments with comma-style: leading.)

Describe the solution you'd like

Document which versions of the standalone tools correspond to the plugins in the released haskell-language-server binaries, so that I can pin my standalone tool installs to those versions.

Describe alternatives you've considered

I can't just go by the bounds listed in the cabal file for the plugin because they admit multiple major versions. The versions listed in the various nix files differ, so I can't go by those either.

@michaelpj
Copy link
Collaborator

Related #411

@michaelpj
Copy link
Collaborator

Here's how I work around this problem: build HLS from source with extra constraints pinning the formatter version to the one that you want. (It might not work, but then at least you know you need to e.g. upgrade the one you use in CI). That way you can ensure that the version you use outside HLS matches the one used by HLS.

@tgiannak
Copy link
Author

I would gladly do that it it were just for myself, but I have a team of Haskell novices that I need to support as well. Matching our CI version to whatever is already distributed via ghcup would be easier than getting them all to build it themselves.

This process of producing the documentation could also be useful internally for figuring out which plugins were keeping which other plugins from being built against their newest versions due to bounds on common dependencies. Trying your suggestion, it looks like (at least) stylish-haskell and fourmolu ^>= 0.5 have conflicting bounds.

@tgiannak
Copy link
Author

Here's how I work around this problem: build HLS from source with extra constraints pinning the formatter version to the one that you want.

This was easier than it sounded: a cabal.project file with just the constraints and flags in an otherwise empty directory does the trick for constraining cabal install haskell-language-server installing from Hackage.

@jneira
Copy link
Member

jneira commented Jan 30, 2022

Here's how I work around this problem: build HLS from source with extra constraints pinning the formatter version to the one that you want.

This was easier than it sounded: a cabal.project file with just the constraints and flags in an otherwise empty directory does the trick for constraining cabal install haskell-language-server installing from Hackage.

nice, i think you could even take ride of the cabal.project with cabal install haskell-language-server --constraint="fourmolu==X.Y.Z" --flags="+myflag"

@georgefst
Copy link
Collaborator

georgefst commented Mar 4, 2022

Agreed that documenting the versions seems like a good idea.

As for the specific problem here, as maintainer of the Fourmolu plugin, I've known this was coming for a while: #2254 (comment). Sorry that you've hit it. We need stylish-haskell to update to ghc-lib-parser-9.2 (EDIT: and Cabal 3.6, but there's no breakage there: haskell/stylish-haskell#375) before we can drop support for older versions of Fourmolu. Fortunately @jaspervdj is working on it: haskell/stylish-haskell#378 (comment). With HLS on GHC 9.2, stylish-haskell is disabled, so we do get Fourmolu 0.5.

@georgefst
Copy link
Collaborator

nice, i think you could even take ride of the cabal.project with cabal install haskell-language-server --constraint="fourmolu==X.Y.Z" --flags="+myflag"

Exact command is:

cabal install haskell-language-server -w ghc-8.10 --constraint='fourmolu >= 0.5' --flag='-stylishHaskell' --allow-newer=stylish-haskell:*

(--allow-newer still needed to remove stylish-haskell line from cabal.project due to a known cabal issue about not treating local packages as optional)

@fendor fendor added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. and removed old_type: documentation labels Jul 13, 2022
@michaelpj
Copy link
Collaborator

You can now get this information with haskell-language-server --list-plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: formatters type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants