haskell / haskell/haskell-language-server

Invalid import is not reported and it breaks the eval plugin

Open
#4,487 4 comments 6 reactions 0 assignees View on GitHub
component: ghcide component: hls-eval-plugin type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

### My environment

OS: MacOS
GHC 9.10.1 from ghcup
Project: https://github.com/noughtmare/tmp.oYnk68xwKl
LSP client: VS Codium+vscode-haskell
HLS: 2.9.0.1 from ghcup
No special configuration

### Steps to reproduce

1. open `app/Main.hs`
2. wait until HLS finishes loading
3. (optional) click the `Evaluate...` action

### Expected behaviour

First of all, of course there is an obvious error in the project: the `Foo` module is not listed in the cabal file. This issue is about how HLS functions in spite of that error.

I expect an error on the line `import Foo` in `app/Main.hs`, because that module is not valid in the cabal package. Furthermore, clicking the `Evaluate...` action should either work without problems or it would also be acceptable if the action was not shown in the first place.

### Actual behaviour

HLS reports no errors in `app/Main.hs`. Clicking the `Evaluate...` action results in a cryptic error:

```
eval: Internal Error: BadDependency "GhcSessionDeps"
```

### Debug information

```
2025-02-05T09:27:43.927413Z | Error | eval: Internal Error: BadDependency "GhcSessionDeps"
[Error - 10:27:43] Request workspace/executeCommand failed.
Message: eval: Internal Error: BadDependency "GhcSessionDeps"
Code: -32603
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.