Skip to content

Commit 9bc684a

Browse files
authored
Improve qualified import plugin readme
After seeing #2603 might as well improve the docs a little so we can maybe link to it.
1 parent d640d13 commit 9bc684a

File tree

1 file changed

+31
-0
lines changed
  • plugins/hls-qualify-imported-names-plugin

1 file changed

+31
-0
lines changed

Diff for: plugins/hls-qualify-imported-names-plugin/README.md

+31
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22

33
![Qualify Imported Names Demo](qualify-imported-names-demo.gif)
44

5+
## Summary
6+
7+
Rewrite imported names to be qualified.
8+
9+
## Motivation
10+
11+
You've imported a number of modules, and have written a lot of code with unqualified names. You want to import a new module but you know there will be a number name clashes so you want to switch your current usage of names to be qualified.
12+
13+
It would be nice if you could change
14+
```
15+
import Blah
16+
```
17+
to
18+
```
19+
import Blah as Bloo
20+
```
21+
then magically qualify all the previous names imported from `Blah` with `Bloo`. After doing that you could then change
22+
```
23+
import Blah as Bloo
24+
```
25+
to
26+
```
27+
import qualified Blah as Bloo
28+
```
29+
and import your the new module using names from it without worry.
30+
31+
Well, now you can...
32+
533
## Usage
634

735
1. Put cursor over the import declaration you want to qualify names from.
@@ -14,6 +42,9 @@
1442
- If the import declaration has an explicit import list then the plugin will qualify only names on the list.
1543
- If the import declaration has an explicit hiding list then the plugin will qualify names from the imported module that are not on the list.
1644

45+
## Future possibilities
46+
- It may be possible to use the LSP rename functionality to ask for a name so that we don't have to do the `as Alias` dance.
47+
1748
## Change log
1849
### 1.0.0.1
1950
- GHC 9.2.1 compatibility

0 commit comments

Comments
 (0)