Cabal Plugin is too strict for the newest cabal versions #4401
Labels
component: hls-cabal-plugin
Issues related to the hls-cabal-plugin
Hackathon
This issue is suitable for hackathon sessions
type: bug
Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Generating a new package with cabal
3.12
via$ mkdir test-hls-cabal $ cd test-hls-cabal $ cabal init --lib -n
Generates a
.cabal
file withcabal-version: 3.12
, whichhaskell-language-server-2.9.0.1
built withghc-9.6.5
, which is linked againstCabal-3.10.3.0
. Consequentially, HLS highlights the whole.cabal
file as incorrect, as it doesn't recognise3.12
as a validcabal-version
.This is bad user-experience.
I am not sure whether we can fix that for good, as older HLS versions will never get linked against a newer
Cabal
version.However, what we could do is to be more lenient when it comes to parsing
.cabal
files.We can scan the
.cabal
file for the linecabal-version:
(scanSpecVersion
) and if the version is not known to us, we parse the cabal file with the newest CabalSpecVersion available to the HLS binary.The
cabal
features may still break if users actually need new cabal-the-spec-features, but for many future changes, we likely only display warnings and many other IDE features keep working.The only real disadvantage is that we can't reliably report incorrect
cabal-version
numbers any more. Also, the proposed behaviour might be unexpected to users.The last resort I can think of, is to simply not provide any IDE features if the cabal-version is seemingly too new for the Cabal version linked into HLS.
The text was updated successfully, but these errors were encountered: