haskell / haskell/haskell-language-server
Can't use test suites for GHC plugins, HLS erroneously claims that build-depends entry is missing
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 13
Description
### Your environment
Ubuntu (under Windows 11 WSL)
ghc 9.4.2 via ghcup
Reproduction repo with minimal example:
https://github.com/JakobBruenker/a-cabal-error
Which LSP client (editor/plugin) do you use?
VS Code, but running haskell-language-server outside of it produces the same error
Which version of HLS do you use and how did you install it?
1.8.0.0 via ghcup
Have you configured HLS in any way (especially: a `hie.yaml` file)?
No (though an `hie.yaml` file generated via implicit-hie seemed to make no difference)
### Steps to reproduce
Run haskell-language-server on the reproduction repo linked above
### Expected behaviour
There should only be one error, `Variable not in scope: thisShouldBeAnError :: IO ()`
### Actual behaviour
The expected error appears, but another error appears as well:
```
Unexpected usage error
Could not load module ‘APlugin’
It is a member of the hidden package ‘a-cabal-error-0.1.0.0’.
Perhaps you need to add ‘a-cabal-error’ to the build-depends in your .cabal file.
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
```
This is rather strange, since the .cabal file *does* contain that dependency, and `cabal test` runs fine.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue in the linked a-cabal-error repository with HLS 1.8.0.0 and GHC 9.4.2, then inspect how HLS handles test suites containing GHC plugins and their build-depends entries. Done means the reproduction reports only the intended out-of-scope variable error while cabal test continues to pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100