haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

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

Open dragospe opened this issue 1 year ago • 1 comments

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

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

import Foo <import Foo (bar, Baz (..))>`

producing an import list like

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

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

dragospe avatar Jun 08 '24 14:06 dragospe

cc @jetjinser, I think this could be another nice use for inlay hints!

michaelpj avatar Jun 08 '24 14:06 michaelpj