Old working simple small project. HLS used to work fine on it. Now it fails to do anything useful - no completion, no documentation popup, etc.
haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools* Which lsp-client do you use: `VS Code` (current version)
* Describe your project: https://github.com/mouse07410/Str2Split.git
### Steps to reproduce
Clone https://github.com/mouse07410/Str2Split.git and open it in VSCode with Haskell plugin and the current HLS master built.
### Expected behaviour
HLS should work ;-)
### Actual behaviour
Error messages like
Multi Cradle: No prefixes matched
pwd: /Users/ur20980/Src/Str2Split
filepath: /Users/ur20980/src/Str2Split/app/Main.hs
prefixes:
("./src",Cabal {component = Just "lib:Str2Split"})
("./app/Main.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./app/Paths_Str2Split.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./test",Cabal {component = Just "Str2Split:test:Str2Split-test"})

Some output:
Current directory: /Users/ur20980/src/Str2Split
Operating system: darwin
Arguments: ["--lsp"]
Cradle directory: /Users/ur20980/src/Str2Split
Cradle type: Cabal
Tool versions found on the $PATH
cabal: 3.2.0.0
stack: 2.3.3
ghc: 8.10.2
Consulting the cradle to get project GHC version...
Project GHC version: 8.10.2
haskell-language-server exe candidates: ["haskell-language-server-8.10.2","haskell-language-server-8.10","haskell-language-server"]
Launching haskell-language-server exe at:/Users/ur20980/.cabal/bin/haskell-language-server-8.10.2
haskell-language-server version: 0.4.0.0 (GHC: 8.10.2) (PATH: /Users/ur20980/.cabal/bin/haskell-language-server-8.10.2)
Starting (haskell-language-server)LSP server...
with arguments: LspArguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
with plugins: [PluginId "brittany",PluginId "eval",PluginId "floskell",PluginId "fourmolu",PluginId "ghcide",PluginId "importLens",PluginId "ormolu",PluginId "pragmas",PluginId "retrie",PluginId "stylish-haskell"]
in directory: /Users/ur20980/src/Str2Split
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
Started LSP server in 0.01s
2020-09-09 01:39:48.290323 [ThreadId 17] - Opened text document: file:///Users/ur20980/Src/Str2Split/app/Main.hs
2020-09-09 01:39:48.291906 [ThreadId 47] - Consulting the cradle for "/Users/ur20980/src/Str2Split/app/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/Src/Str2Split", cradleOptsProg = CradleAction: Cabal}
2020-09-09 01:39:48.294344 [ThreadId 69] - Consulting the cradle for "/Users/ur20980/src/Str2Split/app/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
2020-09-09 01:39:48.559882 [ThreadId 83] - Plugin.makeCodeLens (ideLogger)
2020-09-09 01:39:48.560337 [ThreadId 84] - finish: codeLens (took 0.00s)
2020-09-09 01:39:48.560662 [ThreadId 86] - finish: importLens (took 0.00s)
2020-09-09 01:39:48.561389 [ThreadId 90] - finish: importLens (took 0.00s)
Resolving dependencies...
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):
- Str2Split-0.1.0.0 (lib) (configuration changed)
- Str2Split-0.1.0.0 (exe:Str2Split-exe) (configuration changed)
Configuring library for Str2Split-0.1.0.0..
Preprocessing library for Str2Split-0.1.0.0..
Building library for Str2Split-0.1.0.0..
Preprocessing library for Str2Split-0.1.0.0..
Running Haddock on library for Str2Split-0.1.0.0..
Haddock coverage:
0% ( 0 / 5) in 'Lib'
Missing documentation for:
Module header
splitStr (src/Lib.hs:12)
chunker (src/Lib.hs:26)
splitMore (src/Lib.hs:29)
splitLess (src/Lib.hs:32)
Documentation created:
/Users/ur20980/src/Str2Split/dist-newstyle/build/x86_64-osx/ghc-8.10.2/Str2Split-0.1.0.0/doc/html/Str2Split/index.html
Configuring executable 'Str2Split-exe' for Str2Split-0.1.0.0..
Warning: The package has an extraneous version range for a dependency on an
internal library: Str2Split -any && ==0.1.0.0, Str2Split -any && ==0.1.0.0.
This version range includes the current package but isn't needed as the
current package's library will always be used.
Preprocessing executable 'Str2Split-exe' for Str2Split-0.1.0.0..
2020-09-09 01:39:58.573391 [ThreadId 69] - Using interface files cache dir: /Users/ur20980/.cache/ghcide/main-477b19ba0d9e17682dba882b9084c5084a91c2f7
2020-09-09 01:39:58.573615 [ThreadId 69] - Making new HscEnv[main]
2020-09-09 01:42:08.809862 [ThreadId 232] - finish: CodeAction (took 0.00s)
2020-09-09 01:42:08.809901 [ThreadId 234] - finish: CodeAction:PackageExports (took 0.00s)
### Include debug information
Execute in the root of your project the command `haskell-language-server --debug .` and paste the logs here:
$ haskell-language-server --debug
haskell-language-server version: 0.4.0.0 (GHC: 8.10.2) (PATH: /Users/ur20980/.cabal/store/ghc-8.10.2/hskll-lngg-srvr-0.4.0.0-8167ddf8/bin/haskell-language-server)
(haskell-language-server)Ghcide setup tester in /Users/ur20980/src/Str2Split.
Report bugs at https://github.com/haskell/haskell-language-server/issues
Tool versions found on the $PATH
cabal: 3.2.0.0
stack: 2.3.3
ghc: 8.10.2
Step 1/4: Finding files to test in /Users/ur20980/src/Str2Split
Found 7 files
Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
Step 3/4: Initializing the IDE
Step 4/4: Type checking the files
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/out/test/Str2Split/Spec.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
File: /Users/ur20980/src/Str2Split/out/test/Str2Split/Spec.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
Multi Cradle: No prefixes matched
pwd: /Users/ur20980/src/Str2Split
filepath: /Users/ur20980/src/Str2Split/out/test/Str2Split/Spec.hs
prefixes:
("./src",Cabal {component = Just "lib:Str2Split"})
("./app/Main.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./app/Paths_Str2Split.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./test",Cabal {component = Just "Str2Split:test:Str2Split-test"})
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/src/Lib.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
Resolving dependencies...
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):
- Str2Split-0.1.0.0 (lib) (configuration changed)
Configuring library for Str2Split-0.1.0.0..
Preprocessing library for Str2Split-0.1.0.0..
[INFO] Using interface files cache dir: /Users/ur20980/.cache/ghcide/Str2Split-0.1.0.0-inplace-525664db47757645ab8996fabc809c4e8b5d3fa2
[INFO] Making new HscEnv[Str2Split-0.1.0.0-inplace]
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/out/production/Str2Split/Lib.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
File: /Users/ur20980/src/Str2Split/out/production/Str2Split/Lib.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
Multi Cradle: No prefixes matched
pwd: /Users/ur20980/src/Str2Split
filepath: /Users/ur20980/src/Str2Split/out/production/Str2Split/Lib.hs
prefixes:
("./src",Cabal {component = Just "lib:Str2Split"})
("./app/Main.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./app/Paths_Str2Split.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./test",Cabal {component = Just "Str2Split:test:Str2Split-test"})
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/out/production/Str2Split/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
File: /Users/ur20980/src/Str2Split/out/production/Str2Split/Main.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
Multi Cradle: No prefixes matched
pwd: /Users/ur20980/src/Str2Split
filepath: /Users/ur20980/src/Str2Split/out/production/Str2Split/Main.hs
prefixes:
("./src",Cabal {component = Just "lib:Str2Split"})
("./app/Main.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./app/Paths_Str2Split.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./test",Cabal {component = Just "Str2Split:test:Str2Split-test"})
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/Setup.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
File: /Users/ur20980/src/Str2Split/Setup.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
Multi Cradle: No prefixes matched
pwd: /Users/ur20980/src/Str2Split
filepath: /Users/ur20980/src/Str2Split/Setup.hs
prefixes:
("./src",Cabal {component = Just "lib:Str2Split"})
("./app/Main.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./app/Paths_Str2Split.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./test",Cabal {component = Just "Str2Split:test:Str2Split-test"})
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/app/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
Resolving dependencies...
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):- Str2Split-0.1.0.0 (lib) (configuration changed)
- Str2Split-0.1.0.0 (exe:Str2Split-exe) (configuration changed)
Configuring library for Str2Split-0.1.0.0..
Preprocessing library for Str2Split-0.1.0.0..
Building library for Str2Split-0.1.0.0..
Preprocessing library for Str2Split-0.1.0.0..
Running Haddock on library for Str2Split-0.1.0.0..
Haddock coverage:
0% ( 0 / 5) in 'Lib'
Missing documentation for:
Module header
splitStr (src/Lib.hs:12)
chunker (src/Lib.hs:26)
splitMore (src/Lib.hs:29)
splitLess (src/Lib.hs:32)
Documentation created:
/Users/ur20980/src/Str2Split/dist-newstyle/build/x86_64-osx/ghc-8.10.2/Str2Split-0.1.0.0/doc/html/Str2Split/index.html
Configuring executable 'Str2Split-exe' for Str2Split-0.1.0.0..
Warning: The package has an extraneous version range for a dependency on an
internal library: Str2Split -any && ==0.1.0.0, Str2Split -any && ==0.1.0.0.
This version range includes the current package but isn't needed as the
current package's library will always be used.
Preprocessing executable 'Str2Split-exe' for Str2Split-0.1.0.0..
[INFO] Using interface files cache dir: /Users/ur20980/.cache/ghcide/main-76cf0c422bbdf524683ea9b657cb74be4ebdf099
[INFO] Using interface files cache dir: /Users/ur20980/.cache/ghcide/Str2Split-0.1.0.0-inplace-477b19ba0d9e17682dba882b9084c5084a91c2f7
[INFO] Making new HscEnv[main,Str2Split-0.1.0.0-inplace]
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/test/Spec.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
Resolving dependencies...
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):- Str2Split-0.1.0.0 (lib) (configuration changed)
- Str2Split-0.1.0.0 (test:Str2Split-test) (configuration changed)
Configuring library for Str2Split-0.1.0.0..
Preprocessing library for Str2Split-0.1.0.0..
Building library for Str2Split-0.1.0.0..
Preprocessing library for Str2Split-0.1.0.0..
Running Haddock on library for Str2Split-0.1.0.0..
Haddock coverage:
0% ( 0 / 5) in 'Lib'
Missing documentation for:
Module header
splitStr (src/Lib.hs:12)
chunker (src/Lib.hs:26)
splitMore (src/Lib.hs:29)
splitLess (src/Lib.hs:32)
Documentation created:
/Users/ur20980/src/Str2Split/dist-newstyle/build/x86_64-osx/ghc-8.10.2/Str2Split-0.1.0.0/doc/html/Str2Split/index.html
Configuring test suite 'Str2Split-test' for Str2Split-0.1.0.0..
Warning: The package has an extraneous version range for a dependency on an
internal library: Str2Split -any && ==0.1.0.0, Str2Split -any && ==0.1.0.0.
This version range includes the current package but isn't needed as the
current package's library will always be used.
Preprocessing test suite 'Str2Split-test' for Str2Split-0.1.0.0..
[INFO] Using interface files cache dir: /Users/ur20980/.cache/ghcide/main-53a575cdbdd154838b6b3e57a3c382a75826f26e
[INFO] Using interface files cache dir: /Users/ur20980/.cache/ghcide/main-53a575cdbdd154838b6b3e57a3c382a75826f26e
[INFO] Using interface files cache dir: /Users/ur20980/.cache/ghcide/Str2Split-0.1.0.0-inplace-97d99a01d26c96ede6ffdd5955c2630bfa6e6aff
[INFO] Making new HscEnv[main,main,Str2Split-0.1.0.0-inplace]
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/out/production/Str2Split/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/out/test/Str2Split/Spec.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/Setup.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
[INFO] Consulting the cradle for "/Users/ur20980/src/Str2Split/out/production/Str2Split/Lib.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/ur20980/src/Str2Split", cradleOptsProg = CradleAction: Cabal}
Files that failed:- /Users/ur20980/src/Str2Split/Setup.hs
- /Users/ur20980/src/Str2Split/out/production/Str2Split/Lib.hs
- /Users/ur20980/src/Str2Split/out/production/Str2Split/Main.hs
- /Users/ur20980/src/Str2Split/out/test/Str2Split/Spec.hs
Completed (3 files worked, 4 files failed)
```
Haskell extension (VS Code) is now telling me that I don't have Cabal installed!

Needless to say, cabal-install is where it always been:

Hi, thank you for the concise bug report!
Question:
("./src",Cabal {component = Just "lib:Str2Split"})
("./app/Main.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./app/Paths_Str2Split.hs",Cabal {component = Just "Str2Split:exe:Str2Split-exe"})
("./test",Cabal {component = Just "Str2Split:test:Str2Split-test"})
This does not fit to the hie.yaml in the linked project. Did you change it?
Regarding the missing cabal, there are some bug reports it about already. https://github.com/haskell/haskell-language-server/issues/236
Hi, thank you for concise bug report!
;-)
This does not fit to the hie.yaml in the linked project. Did you change it?
When I got the error I reported, I tried replacing hie.yaml with output of gen-hie. It did not help.
What seemed to remedy the No prefix matched" issue was changinghie.yaml` to this:
cradle:
cabal:
- path: "./src"
component: "lib:Str2Split"
- path: "./app"
component: "exe:Str2Split-exe"
- path: "./test"
component: "test:Str2Split-test"
But even with "no prefix matched" error gone, HLS is still playing dead, in the sense that I'm not getting completions, documentation popups, etc.
It is dead because it can't find cabal, right? So, haskell-language-server --debug ./app/Main.hs ought to work?
It is dead because it can't find cabal, right?
I do not know! That "can't find cabal" error popped up only after quite some time of struggling with that "no prefix..." thing. And the Action Buttons ("Cabal Build", "Cabal Run") all worked all the time.
Weird - I discarded all the changes, removed from the PATH an empty (but existing!) directory, tried code . - and it worked.
Then I tried starting VSCode from the GUI, and opened the Str2Split directory - and again, it worked.
I don't know what to say.
Let me close this one for now, as it appears to work now - for no reason, just like it failed for no reason that I could discern ;).
I'll re-open if/when this problem re-surfaces. Thanks!
Most helpful comment
Let me close this one for now, as it appears to work now - for no reason, just like it failed for no reason that I could discern ;).
I'll re-open if/when this problem re-surfaces. Thanks!