haskell / haskell/haskell-language-server

HLS loops forever on bogus cyclic import introduced by the duplicate module names

Open
#4,265 3 comments 2 reactions 1 assignee Claimed by @wz1000 View on GitHub
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? macOS Sonoma 14.5 (23F79)

Which version of GHC do you use and how did you install it? GHC 9.4.8 and 9.8.2, via GHCup ()

How is your project built (alternative: link to the project)? Cabal. See the repro repo: https://github.com/konn/hls-multihome-modname (NOTE: despite the repo name, Multi Home seems irrelevant here - sorry for the confusion)

Which LSP client (editor/plugin) do you use? VSCode + vscode-haskell

Which version of HLS do you use and how did you install it? 2.8.0.0 via GHCup

Have you configured HLS in any way (especially: a `hie.yaml` file)? No `hie.yaml` (see the repro above).

### Steps to reproduce

1. Create a package with two modules: `src/Lib.hs` and `src/Lib/A.hs`
2. Give `src/Lib/A.hs` the same name as `Lib`: put `module Lib where` on top of `src/Lib/A.hs`.
3. import `Lib.A` from `Lib`

### Expected behaviour

HLS must suggest to rename the module name of `Lib/A.hs` to `Lib.A`.

### Actual behaviour

HLS loops indefinitely.

Although the situation is ill-conditioned on the user side, but it can occur relatively easily when one wants to cut out some portion of the existing module to a separate (sub) module. So, it might be good for HLS to be able to handle this case.

### Debug information

[4-Haskell (hls-multihome-modname).log](https://github.com/haskell/haskell-language-server/files/15477365/4-Haskell.hls-multihome-modname.log)

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.