haskell / haskell/haskell-language-server

When main module is a symlink, HLS fails to load it

Open
#4,462 5 comments 0 reactions 0 assignees View on GitHub
status: blocked type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

### Your environment

Which OS do you use?
**NixOS 24.05.6966.190c31a89e5e (Uakari)**

Which version of GHC do you use and how did you install it?
**The Glorious Glasgow Haskell Compilation System, version 9.6.5** from OS package

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

Which LSP client (editor/plugin) do you use?
**VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 01 1980 00:00:00)**
**+ coc.nvim**

Which version of HLS do you use and how did you install it?
**haskell-language-server-9.6.5** from OS package

Have you configured HLS in any way (especially: a `hie.yaml` file)?
**No**

### Steps to reproduce

1. Use `cabal init` to create an executable package
2. `mv Main.hs Real.hs`
3. `ln -s Real.hs Main.hs`
4. Start vim

### Expected behaviour

HLS should load the module and provide hints.

### Actual behaviour

I get a popup on line 1 with text:

```
>>module Main where
Loading the module '/home/b/tmp/symlinkmain/Main.hs' failed.

It may not be listed in your .cabal file!
Perhaps you need to add `Main` to other-modules or exposed-modules.

For more information, visit: https://cabal.readthedocs.io/en/3.4/developing-
packages.html#modules-included-in-the-package
(cradle)
```

The error message is incorrect, at the very least.

### Debug information

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.