Commit 0403dbf
Use exact print for suggest missing constraint code actions (#1221)
* Cache annotated AST
* instance ASTElement RdrName
* appendConstraint + Rewrite abstraction
The Rewrite abstraction is similar to D.IDE.GHC.ExactPrint.Graft but it
does fewer things more efficiently:
- It doesn't annotate things for you (so it doesn't destroy user format)
- It doesn't provide a Monoid instance (for now)
- It doesn't need a fully parsed source
- It doesn't use SYB to perform the replacement
- It doesn't diff to compute the result
The use case is code actions where you don't have the SrcSpan that you need to
edit at hand, and instead you need to traverse the AST manually to locate the declaration to edit
* Refactor suggest constraint code action to use exactprint
Tweaking the suggest constraints tests to reflect the increased precision in
whitespace preservation
* Catch missing 'Monad m' constraints too
* Suggestions for missing implicit parameters
* hlints
* compat
* Include getAnnotatedParsedSourceRule in the main rule
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>1 parent 6f105bd commit 0403dbf
File tree
7 files changed
+417
-140
lines changed- ghcide
- src/Development/IDE
- Core
- GHC
- Plugin
- CodeAction
- test/exe
7 files changed
+417
-140
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
1020 | 1021 | | |
1021 | 1022 | | |
1022 | 1023 | | |
| 1024 | + | |
1023 | 1025 | | |
1024 | 1026 | | |
1025 | 1027 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
21 | 29 | | |
22 | 30 | | |
23 | 31 | | |
| |||
35 | 43 | | |
36 | 44 | | |
37 | 45 | | |
38 | | - | |
| 46 | + | |
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
42 | 53 | | |
43 | 54 | | |
44 | 55 | | |
| |||
47 | 58 | | |
48 | 59 | | |
49 | 60 | | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
57 | 77 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
66 | 82 | | |
67 | 83 | | |
68 | 84 | | |
69 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
70 | 93 | | |
71 | 94 | | |
72 | 95 | | |
| |||
291 | 314 | | |
292 | 315 | | |
293 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
294 | 321 | | |
295 | 322 | | |
296 | 323 | | |
| |||
302 | 329 | | |
303 | 330 | | |
304 | 331 | | |
| 332 | + | |
305 | 333 | | |
306 | 334 | | |
307 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
0 commit comments