Skip to content

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

Open
@chreekat

Description

@chreekat

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: blockedNot actionable, because blocked by upstream/GHC etc.type: 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