Skip to content

HLS 1.5 requires hie.yaml else it would fail to run, but works in HLS 1.2 #2398

Closed
@sekunho

Description

@sekunho

Hello, thanks again for all the work put into HLS!

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

haskell-language-server version: 1.5.0.0 (GHC: 8.10.7) (PATH: /nix/store/ngi32ilj18ppcc78g0kc3z3zq4r3s049-haskell-language-server-1.5.0.0/bin/haskell-language-server)
Tool versions found on the $PATH
cabal:		3.6.2.0
stack:		Not found
ghc:		8.10.7

Which OS do you use:
NixOS 21.05

Which lsp-client do you use:
doom emacs v21.12.0-alpha with haskell mode

Describe your project (alternative: link to the project):
It's a newly generated project with cabal init --interactive with nix flakes to provide the HLS, cabal, and GHC. https://gist.github.com/sekunho/72747c20a192e62a6fc9dc9e9660aa0a

Contents of hie.yaml:
N/A

Steps to reproduce

  1. nix develop (or direnv)
  2. haskell-language-server --debug
  3. Fails to start cause of error

However, it works if I do:

  1. gen-hie > hie.yaml
  2. haskell-language-server

It's strange because when I pin a commit of nixpkgs to one that contains HLS 1.2.0.0 and ghc 8.10.6, it works. It doesn't work with HLS 1.5.0.0 and GHC 8.10.7. How come 1.5 requires hie.yaml while 1.2 doesn't?

Expected behaviour

Shouldn't complain about a bad file descriptor without hie.yaml since it works for 1.2.

Actual behaviour

Complains about a bad file descriptor without it.

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output:
# haskell-language-server --debug

[sekun@nixos:~/Projects/foo]$ haskell-language-server --debug
haskell-language-server version: 1.5.0.0 (GHC: 8.10.7) (PATH: /nix/store/ngi32ilj18ppcc78g0kc3z3zq4r3s049-haskell-language-server-1.5.0.0/bin/haskell-language-server)
 ghcide setup tester in /home/sekun/Projects/foo.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /home/sekun/Projects/foo
Found 2 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  ()

Step 3/4: Initializing the IDE
2021-11-25 14:39:32.955603396 [ThreadId 7] DEBUG hls:	Initializing exports map from hiedb

Step 4/4: Type checking 2021-11-25 14:39:32.956138658 [ThreadId 7] DEBUG hls:	Done initializing exports map from hiedb (0)
the files
2021-11-25 14:39:32.956815549 [ThreadId 31] INFO hls:	Consulting the cradle for "src/Foo.hs"
2021-11-25 14:39:32.956900639 [ThreadId 31] WARNING hls:	No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for src/Foo.hs.
 Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
2021-11-25 14:39:32.970625984 [ThreadId 31] DEBUG hls:	Output from setting up the cradle Cradle {cradleRootDir = "", cradleOptsProg = CradleAction: Cabal}
2021-11-25 14:39:32.972146247 [ThreadId 27] INFO hls:	File:     /home/sekun/Projects/foo/src/Foo.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  cabal: streamingProcess: chdir: invalid argument (Bad file descriptor)
2021-11-25 14:39:32.972431128 [ThreadId 30] INFO hls:	File:     /home/sekun/Projects/foo/test/MyLibTest.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  cabal: streamingProcess: chdir: invalid argument (Bad file descriptor)
2021-11-25 14:39:32.972707809 [ThreadId 19] INFO hls:	finish: User TypeCheck (took 0.02s)
2021-11-25 14:39:32.972927379 [ThreadId 42] INFO hls:	finish: GetHie (took 0.00s)
F2021-11-25 14:39:32.97316226 [ThreadId 49] INFO hls:	finish: GenerateCore (took 0.00s)
iles that failed:
 * /home/sekun/Projects/foo/src/Foo.hs
 * /home/sekun/Projects/foo/test/MyLibTest.hs

Completed (0 files worked, 2 files failed)

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs:
# lsp-log buffer
Command "haskell-language-server --lsp -d -l /tmp/hls.log" is present on the path.
Command "haskell-language-server --lsp -d -l /tmp/hls.log" is present on the path.
Command "haskell-language-server --lsp -d -l /tmp/hls.log" is present on the path.
Found the following clients for /home/sekun/Projects/foo/src/Foo.hs: (server-id lsp-haskell, priority 0)
The following clients were selected based on priority: (server-id lsp-haskell, priority 0)
Creating watchers for following 3 folders:
  /home/sekun/Projects/foo
  /home/sekun/Projects/foo/src
  /home/sekun/Projects/foo/test

# lsp-haskell::stderr
haskell-language-server version: 1.5.0.0 (GHC: 8.10.7) (PATH: /nix/store/ngi32ilj18ppcc78g0kc3z3zq4r3s049-haskell-language-server-1.5.0.0/bin/haskell-language-server)
Starting (haskell-language-server)LSP server...
  with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "/tmp/hls.log", argsThreads = 0, argsProjectGhcVersion = False}
  with plugins: [PluginId "pragmas",PluginId "floskell",PluginId "fourmolu",PluginId "tactics",PluginId "ormolu",PluginId "stylish-haskell",PluginId "retrie",PluginId "brittany",PluginId "callHierarchy",PluginId "class",PluginId "haddockComments",PluginId "eval",PluginId "importLens",PluginId "refineImports",PluginId "moduleName",PluginId "hlint",PluginId "splice",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-code-actions-imports-exports",PluginId "ghcide-code-actions-type-signatures",PluginId "ghcide-code-actions-bindings",PluginId "ghcide-code-actions-fill-holes",PluginId "ghcide-completions",PluginId "ghcide-type-lenses",PluginId "ghcide-core"]
  in directory: /home/sekun/Projects/foo
 Couldn't load cradle for libdir: (CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitSuccess, cradleErrorStderr = ["Couldn't execute cabal --builddir=/home/sekun/.cache/hie-bios/dist-foo-7de3951b2299bde2ff8672638cbcd53f v2-exec --with-compiler /home/sekun/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b ghc -v0 -- --print-libdir"]},"/home/sekun/Projects/foo",Nothing,Cradle {cradleRootDir = "", cradleOptsProg = CradleAction: Cabal})

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: implicit-hieos: nixostype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions