haskell/haskell-language-server

HLS 2.11.0.0 doesn't work with both cabal 3.14.2.0 and 3.16.0.0, and HLS 2.10.0.0 shows compilation errors with cabal 3.16.0.0 even if compiling with cabal is successful

Closed this issue · 6 comments

Your environment

Which OS do you use?
I'm on up-to-date ArchLinux

Which version of GHC do you use and how did you install it?
I manage my Haskell environment via GHCup, which I use to keep GHC, cabal, and HLS relatively up-to-date.

How is your project built (alternative: link to the project)?

The Haskell source code of the project seems to be unimportant. This is enough, for instance

import Data.Char
import Unsafe.Coerce

main :: IO ()
main = undefined

and I suspect you can even remove all but the last line.

The .cabal file is probably more important (despite I presume that the relevant bits from it could be cabal-version and default-language at most):

cabal-version:   3.0
cabal-version:   3.0
name:            app
version:         0.1.0.0

executable app
    main-is:          Main.hs
    build-depends:    base
    hs-source-dirs:   .
    default-language: GHC2024

Which LSP client (editor/plugin) do you use?
Terminal Vim

Which version of HLS do you use and how did you install it?
2.10.0.0 and 2.11.0.0, managed via GHCup.

Have you configured HLS in any way (especially: a hie.yaml file)?
Not that I know of (am I supposed to have such a file in the project, had I done such a configuration?).

Steps to reproduce

Essentially, try the 4 combinations of cabal [3.14.2.0, 3.16.0.0] × HLS [2.10.0.0, 2.11.0.0]. And see if the editor reacts as you expect when you mess up with the code.

Here's a screencast: asciicast

Expected behaviour

I'd expect the language server features to work.

Actual behaviour

The project I used compiled with both versions of cabal, but only pairing cabal 3.14.2.0 with HLS 2.10.0.0 results in the language server providing the expected diagnostics in the editor.

Of the other 3 combinations,

  • cabal 3.16.0.0 × HSL 2.10.0.0 results in HLS claiming this error happens (even if when I compile the package all is fine):
    Failed to parse result of calling cabal
    Failed command: cabal --builddir=/home/enrico/.cache/hie-bios/dist-app-4394646ff9b9f9ca795af074e2219448 v2-repl --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-df5545328ebfb0b680269f72e3a89ac0 /home/enrico/deleteme/app/Main.hs
    Build profile: -w ghc-9.10.1 -O1
    In order, the following will be built (use -v for more details):
     - app-0.1.0.0 (interactive) (exe:app) (cannot read state cache)
    Configuring executable 'app' for app-0.1.0.0...
    Preprocessing executable 'app' for app-0.1.0.0...
    GHCi, version 9.10.1: https://www.haskell.org/ghc/  :? for help
    Loaded GHCi configuration from /home/enrico/myconfigfiles/HOME/#ghci
    [1 of 2] Compiling Main             ( Main.hs, interpreted )
    Ok, one module loaded.
    λ> Leaving GHCi.
    
    
    
    Process Environment:
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/bin/ghc-9.10.1
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/lib
    
  • cabal [3.14.2.0, 3.16.0.0] × HLS 2.11.0.0 both result in HLS not telling showing anything.

Debug information

Please, tell me what I can provide.

Hi, thank you for the bug report!

The incompatibility of cabal 3.16.0.0 with any released HLS binary is documented https://discourse.haskell.org/t/cabal-3-16-0-0-released/12544, haskell/hie-bios#467, #4660 and a couple of others.

So unfortunately, to fix this, you are asked to compile HLS from source via ghcup compile hls -v 2.11.0.0 --ghc .... This binary should be compatible with cabal 3.16.0.0.

I am unaware of any issues with cabal 3.14.2.0 and HLS 2.11.0.0, I am using it myself as my daily driver on arch linux, so please also include the logs for this configuration :)

No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.11.0.0 x86_64 ghc-9.10.2
Current directory: /home/enrico/deleteme/app
Operating system: linux
Arguments: ["--lsp"]
Cradle directory: /home/enrico/deleteme/app
Cradle type: Cabal

Tool versions found on the $PATH
cabal:          3.14.2.0
stack:          Not found
ghc:            9.10.1


Consulting the cradle to get project GHC version...
2025-08-14T19:55:39.894863Z | Debug | cabal --numeric-version
2025-08-14T19:55:39.904157Z | Debug | cabal path --output-format=json
2025-08-14T19:55:39.928619Z | Debug | /home/enrico/.ghcup/bin/ghc --numeric-version
Project GHC version: 9.10.1
haskell-language-server exe candidates: ["haskell-language-server-9.10.1","haskell-language-server"]
Failed to find a HLS version for GHC 9.10.1
Executable names we failed to find: haskell-language-server-9.10.1,haskell-language-server
 2025-08-14T19:55:39.929379Z | Info | Starting server
2025-08-14T19:55:39.930125Z | Debug | LSP: set new config: {  }
2025-08-14T19:55:39.930831Z | Warning | LSP: can't register dynamically for: "workspace/didChangeConfiguration"
2025-08-14T19:55:39.931040Z | Debug | LSP: not requesting configuration since the client does not support workspace/configuration
2025-08-14T19:55:39.931216Z | Error | LSP: no handler for: "initialized"
2025-08-14T19:55:39.931372Z | Debug | LSP: set new config: {  }
2025-08-14T19:55:39.931477Z | Debug | LSP: not requesting configuration since the client does not support workspace/configuration
2025-08-14T19:55:39.931642Z | Error | LSP: no handler for: "workspace/didChangeConfiguration"
2025-08-14T19:55:39.931840Z | Debug | VFS: opening file:///home/enrico/deleteme/app/Main.hs
2025-08-14T19:55:39.932047Z | Error | LSP: no handler for: "textDocument/didOpen"
2025-08-14T19:55:47.894327Z | Error | LSP: no handler for: "textDocument/didChange"
2025-08-14T19:55:48.265551Z | Error | LSP: no handler for: "textDocument/didChange"
2025-08-14T19:55:52.659955Z | Error | LSP: no handler for: "textDocument/hover"

the last tree lines are consequence of x, u, and the combo that I mapped to triggering the hovering action.

Is this what you asked for?

Is this what you asked for?

Yes, thank you!

Failed to find a HLS version for GHC 9.10.1
Executable names we failed to find: haskell-language-server-9.10.1,haskell-language-server

Looks like there is no HLS binary available on the path for GHC 9.10.1, what haskell-language-server binaries are on path?

Looks like there is no HLS binary available on the path for GHC 9.10.1, what haskell-language-server binaries are on path?

Sorry, I forgot about this. Anyway, what do you mean? Are the possible Tab-completions an answer? If so, they are at the bottom, but probably they are not relevant anymore with respect to what I had when I reported the issue.

However, right now, I can repro what reported in my previous message, because in the meanwhile I must have updated things. One thing I notice in my previous message is

Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.11.0.0 x86_64 ghc-9.10.2

vs

ghc:            9.10.1

Was this inconsistency (9.10.2 vs 9.10.1) important? What is it symptomatic of?

haskell-language-server-9.10.1@           haskell-language-server-9.12.2~2.11.0.0@  haskell-language-server-9.8.4@
haskell-language-server-9.10.1~2.11.0.0   haskell-language-server-9.4.8@            haskell-language-server-9.8.4~2.11.0.0@
haskell-language-server-9.10.2@           haskell-language-server-9.4.8~2.11.0.0@   haskell-language-server-wrapper@
haskell-language-server-9.10.2~2.11.0.0@  haskell-language-server-9.6.7@            haskell-language-server-wrapper-2.11.0.0
haskell-language-server-9.12.2@           haskell-language-server-9.6.7~2.11.0.0@

Was this inconsistency (9.10.2 vs 9.10.1) important?

No, this is not important, the wrapper has been compiled with 9.10.2 but your project is using 9.10.1.

Is it still not working? If not, please provide the logs again of the failing run :)

Is it still not working? If not, please provide the logs again of the failing run :)

At the moment I'm on HLS 2.11.0.0 x cabal 3.14.2.0 and HLS seems to work. Not sure what was going on at that time, sorry.

Luckily there's a screencast proving I'm not crazy 😮‍💨