Skip to content

Commit

Permalink
Add resolve support in refine imports by merging it with explicit imp…
Browse files Browse the repository at this point in the history
…orts (#3729)
  • Loading branch information
joyfulmantis authored Aug 1, 2023
1 parent ec1e6c1 commit 6111a10
Show file tree
Hide file tree
Showing 49 changed files with 358 additions and 893 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/hackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
"hls-class-plugin", "hls-eval-plugin", "hls-explicit-imports-plugin",
"hls-haddock-comments-plugin", "hls-hlint-plugin", "hls-stan-plugin",
"hls-module-name-plugin", "hls-pragmas-plugin",
"hls-refine-imports-plugin", "hls-rename-plugin", "hls-retrie-plugin",
"hls-rename-plugin", "hls-retrie-plugin",
"hls-splice-plugin", "hls-tactics-plugin",
"hls-call-hierarchy-plugin", "hls-alternate-number-format-plugin",
"hls-qualify-imported-names-plugin", "hls-code-range-plugin",
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ jobs:
name: Test hls-tactics-plugin test suite
run: cabal test hls-tactics-plugin --test-options="$TEST_OPTS" || cabal test hls-tactics-plugin --test-options="$TEST_OPTS"

- if: matrix.test
name: Test hls-refine-imports-plugin test suite
run: cabal test hls-refine-imports-plugin --test-options="$TEST_OPTS" || cabal test hls-refine-imports-plugin --test-options="$TEST_OPTS"

- if: matrix.test
name: Test hls-explicit-imports-plugin test suite
run: cabal test hls-explicit-imports-plugin --test-options="$TEST_OPTS" || cabal test hls-explicit-imports-plugin --test-options="$TEST_OPTS"
Expand Down
1 change: 0 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
/plugins/hls-ormolu-plugin @georgefst
/plugins/hls-pragmas-plugin @berberman @Ailrun @eddiemundo
/plugins/hls-qualify-imported-names-plugin @eddiemundo
/plugins/hls-refine-imports-plugin
/plugins/hls-rename-plugin @OliverMadine
/plugins/hls-refactor-plugin @santiweight
/plugins/hls-retrie-plugin @pepeiborra
Expand Down
2 changes: 0 additions & 2 deletions bench/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ configurations:
- ormolu
- pragmas
- qualifyImportedNames
- refineImports
- rename
- stylish-haskell
# - alternateNumberFormat
Expand Down Expand Up @@ -168,7 +167,6 @@ configurations:
# # - ormolu
# - pragmas
# - qualifyImportedNames
# - refineImports
# - rename
# - retrie
# - splice
Expand Down
1 change: 0 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ packages:
./plugins/hls-class-plugin
./plugins/hls-eval-plugin
./plugins/hls-explicit-imports-plugin
./plugins/hls-refine-imports-plugin
./plugins/hls-hlint-plugin
./plugins/hls-rename-plugin
./plugins/hls-retrie-plugin
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Here is a list of the additional settings currently supported by `haskell-langua
Plugins have a generic config to control their behaviour. The schema of such config is:

- `haskell.plugin.${pluginName}.globalOn`: usually with default true. Whether the plugin is enabled at runtime or it is not. That is the option you might use if you want to disable completely a plugin.
- Actual plugin names are: `ghcide-code-actions-fill-holes`, `ghcide-completions`, `ghcide-hover-and-symbols`, `ghcide-type-lenses`, `ghcide-code-actions-type-signatures`, `ghcide-code-actions-bindings`, `ghcide-code-actions-imports-exports`, `eval`, `moduleName`, `pragmas`, `refineImports`, `importLens`, `class`, `tactics` (aka wingman), `hlint`, `haddockComments`, `retrie`, `rename`, `splice`, `stan`.
- Actual plugin names are: `ghcide-code-actions-fill-holes`, `ghcide-completions`, `ghcide-hover-and-symbols`, `ghcide-type-lenses`, `ghcide-code-actions-type-signatures`, `ghcide-code-actions-bindings`, `ghcide-code-actions-imports-exports`, `eval`, `moduleName`, `pragmas`, `importLens`, `class`, `tactics` (aka wingman), `hlint`, `haddockComments`, `retrie`, `rename`, `splice`, `stan`.
- So to disable the import lens with an explicit list of module definitions you could set `haskell.plugin.importLens.globalOn: false`
- `haskell.plugin.${pluginName}.${lspCapability}On`: usually with default true. Whether a concrete plugin capability is enabled.
- Capabilities are the different ways a lsp server can interact with the editor. The current available capabilities of the server are: `callHierarchy`, `codeActions`, `codeLens`, `diagnostics`, `hover`, `symbols`, `completion`, `rename`.
Expand Down
18 changes: 9 additions & 9 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ Code action kind: `quickfix.literals.style`

Make import lists fully explicit (same as the code lens).

### Refine import

Provided by: `hls-explicit-imports-plugin`

Code action kind: `quickfix.import.refine`

Refines imports to more specific modules when names are re-exported (same as the code lens).

### Qualify imported names

Provided by: `hls-qualify-imported-names-plugin`
Expand All @@ -192,14 +200,6 @@ Rewrites imported names to be qualified.

For usage see the ![readme](../plugins/hls-qualify-imported-names-plugin/README.md).

### Refine import

Provided by: `hls-refine-imports-plugin`

Code action kind: `quickfix.import.refine`

Refines imports to more specific modules when names are re-exported (same as the code lens).

### Add missing class methods

Provided by: `hls-class-plugin`
Expand Down Expand Up @@ -354,7 +354,7 @@ Shows fully explicit import lists and rewrites them with a click (same as the co

### Refine import code lens

Provided by: `hls-refine-imports-plugin`
Provided by: `hls-explicit-imports-plugin`

Shows refined imports and applies them with a click (same as the code action).

Expand Down
1 change: 0 additions & 1 deletion docs/support/plugin-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ For example, a plugin to provide a formatter which has itself been abandoned has
| `hls-qualify-imported-names-plugin` | 2 | |
| `hls-ormolu-plugin` | 2 | |
| `hls-rename-plugin` | 2 | |
| `hls-refine-imports-plugin` | 2 | |
| `hls-stylish-haskell-plugin` | 2 | |
| `hls-tactics-plugin` | 2 | 9.2, 9.4, 9.6 |
| `hls-overloaded-record-dot-plugin` | 2 | 8.10, 9.0 |
Expand Down
11 changes: 0 additions & 11 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ flag importLens
default: True
manual: True

flag refineImports
description: Enable refineImports plugin
default: True
manual: True

flag rename
description: Enable rename plugin
default: True
Expand Down Expand Up @@ -251,11 +246,6 @@ common importLens
build-depends: hls-explicit-imports-plugin == 2.1.0.0
cpp-options: -Dhls_importLens

common refineImports
if flag(refineImports)
build-depends: hls-refine-imports-plugin == 2.1.0.0
cpp-options: -Dhls_refineImports

common rename
if flag(rename)
build-depends: hls-rename-plugin == 2.1.0.0
Expand Down Expand Up @@ -377,7 +367,6 @@ library
, haddockComments
, eval
, importLens
, refineImports
, rename
, retrie
, tactic
Expand Down
Loading

0 comments on commit 6111a10

Please sign in to comment.