haskell / haskell/haskell-language-server

Add option to fully expand explicit import list (`import Foo (Bar (..))` -> `import Foo (Bar (Baz))`)

Open
#4,287 1 comment 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

## Is your enhancement request related to a problem? Please describe.

Currently, the "make imports explicit" option produces something like

```hs
import Foo `
```

producing an import list like

```hs
import Foo (bar, Baz (..))`
```

I (personally) prefer a fully explicit import list -- one that imports all data constructors.
The primary reason is because it can help greatly in tracking down in-scope names when code is broken and tooling fails.

Thus, I'd prefer

```hs
import Foo (bar, Baz (Qux))
```

## Describe the solution you'd like

I would like to see:

- An (preferably default) option to do a fully-explicit import for all data constructors
- An option (I think these are called lenses or inlay hints?) to turn partially explicit (`Bar (..)`) imports to fully explicit ones

## Describe alternatives you've considered

Alternatives would include:

- making this a non-default option,
- providing only the two-step behavior of "make partially explicit (`Bar (..)`); make fully explicit (`Bar(Baz)`)

## Additional context

None

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.