Skip to content

Support refactoring the export list #4948

Description

@crtschin

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

HLS doesn't provide that many tools for working with a module's export list. IIRC the only one is when a diagnostic is raised on an unused symbol, the refactor plugin offers to export the symbol. It would be nice if there were more utilities.

Describe the solution you'd like

There's a few tools I can imagine being useful.

  1. Exporting an already used symbol (one that doesn't raise a diagnostic because it's used in an already exported symbol)
  2. Unexporting a symbol.
  3. Exporting all symbols in a module.
  4. Turning a module with blanket exports into one that minimally exports according to in-project usages.

Of these (4) is the one I really want, where I often manually go over each exported symbol, do a "find all references" request, and trim the export list if there are no usages. It's also the hardest one to implement. First step is to probably limit the code action to non-exposed modules (not listed in .cabal exposed-modules list).

This subsumes the existing diagnostic-only action in the refactor plugin.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions