cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Cabal and HLS should coordinate the `cabal-version` generated by `cabal init`

Open fendor opened this issue 1 year ago • 0 comments

Describe the feature request

HLS is about to add support for .cabal files, displaying errors and warnings, offering completions, etc...

The .cabal file generated by cabal init has the latest available cabal-version.

For example:

> mkdir munihac-test 
> cd munihac-test 
> cabal-3.12.1.0 init -n --lib
> head -n 1 munihac-test.cabal
cabal-version:      3.12

This poses a problem for HLS, as HLS depends on ghc, we have to use the Cabal version linked against the ghc version the HLS binary supports. This means that the cabal-version produced by cabal init is by default virtually always newer than what any HLS version supports.

This leads to an ugly error message and most features not working in the hls-cabal-plugin : image

My suggestion, after talking to @Kleidukos, is to coordinate the default cabal-version produced by cabal init with the support window of HLS. ~~As the HLS-2.9.0.1 release supports GHC 9.4 - 9.10, we consequentially need the default cabal-version to be 3.6 (assuming, ghc-9.4 is linked against Cabal-3.6) for a better UX.~~

EDIT: incorrect assumption of mine. HLS 2.9.0.1 ships with Cabal-3.10, so cabal-version: 3.8 would work for us.

Additional context HLS issue: https://github.com/haskell/haskell-language-server/issues/4401

The issue is softened once private dependencies allow us to depend on a newer, private Cabal version for the cabal plugin: https://github.com/haskell/cabal/pull/9743

fendor avatar Oct 12 '24 08:10 fendor