haskell / haskell/haskell-language-server
"Refine imports" code lens suggests to import internal module in multi-component project
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 13
Description
### Example
Project structure:
```
├── hls-issues.cabal
├── src
│ ├── Internal.hs
│ └── Lib.hs
└── test
└── Test.hs
```
#### Internal.hs
```hs
module Internal (example) where
example :: Int
example = 5
```
#### hls-issues.cabal
```
cabal-version: 2.4
name: hls-issues
version: 0.1.0.0
library
exposed-modules: Lib
other-modules:
Internal
build-depends: base ^>= 4.15, containers
hs-source-dirs: src
default-language: Haskell2010
test-suite test
hs-source-dirs: test
main-is: Test.hs
type: exitcode-stdio-1.0
build-depends: base ^>= 4.15, hls-issues
default-language: Haskell2010
```
#### Lib.hs
```hs
module Lib (example) where
import Internal
```
#### Test.hs
```hs
import Lib (example)
lol :: Int
lol = example
```

HLS suggests to refine the imports to import `Internal`, eventhough `Internal` is not exposed from the library component and thus can't be used in the test suite.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the supplied hls-issues.cabal project and its src/Internal.hs, src/Lib.hs, and test/Test.hs files. Start by tracing HLS's "Refine imports" code lens for the test component; done means it no longer suggests importing Internal when that module is not exposed by the library component.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100