Commit b87bdb9
Support structured diagnostics 2 (#4433)
* Change FileDiagnostic type synonym to a datatype
* Make `ideErrorWithSource` produce FileDiagnostic by adding filepath arg
* Supply structured error wherever we easily can - TODOs for hard parts
We're leaving the TODOs for either later in this PR or in another PR
* Fix UnitTests for new FileDiagnostic struct
* Remove explicit uses of FileDiagnostic, add codes to LSP diagnostics
* Add field for expected error codes in ghcide tests
* Expect GHC-83865 for "type error" test - basic test
* Return structured warnings in TcModuleResult by copying from Driver
* Store FileDiagnostic instead of LSP Diagnostic in Shake store
* Add expected error codes for diagnostics that have them
* Dispatch TODOs, amend remaining TODOs as future work
* Add scary comments all over copied code in Compat.Driver
* Update all remaining diagnostics that could use an expected error code
* Add _code to pretty printing for FileDiagnostic
* Use case instead of `maybe` for StructuredMessage match
* Use CPP to prevent setting _code before structured errors
* Swap modifier for lenses, document StructuredMessage type
* Add link to Issue & MR to Compat.Driver
* Drop attachReason logic from withWarnings, technically incorrect
* Revert "Drop attachReason logic", needed by pragmas-plugin
This reverts commit 4fed987.
* Fix plugins where necessary for new diagnostic structure
* Fix build issues with other tests from `expectDiagnostics`
* Improve comment on metadata fdStructuredMessage in FileDiagnostic
* Add note to withWarnings explaining the current state of things
* Attach reasons into data field of LSP Diagnostic instead of code field
Had to move `attachReason` between modules to achieve this, which is
fine because it was never exported from its own module.
* Fix up mistakes from merge, TODO fix merge issues for 9.3.0
* Set CodeDescription from HaskellErrorIndex when available
* Remove debugging print, fix expectation for preprocessor tests
* Fix CPP for using Show instance on DiagnosticCode
* Remove diagFromErrMsgs for GHC version < 9.6.1 using CPP
* CPP fix
* More stylish-haskell, more CPP fix
* Fix all stylish-haskell errors triggering
* Fix more CPP
* Only override the LSP diagnostic code when not already set
* Fixes for stylish-haskell
stylish-haskell does not handle CPP pragmas very well, is this a
regression?
* Qualify s, t for FuzzySearch
* Ignore use of unsafePerformIO in FuzzySearch
* Properly split GHC.Types.Error import in Diagnostics for stylish-haskell
* Force type signature of annotation on FuzzySearch.dictionary
* DRY up definition of closure_errs
From review #4311 (comment)
* Remove unused imports
* Post-rebase fixes
* stylish-haskell formatting
* Fix issue with GHC 9.4
* Please stylish-haskell
* Ignore error codes when testing GHC 9.4
* Workaround darwin GHC bug in hls-hlint-plugin
* Put the workaround in the right place
* Revert "Set CodeDescription from HaskellErrorIndex when available"
This reverts commit 14d6697.
* Resolve fendor's feedback
* Apply stylish-haskell formatting
* Apply more stylish-haskell formatting
* Resolve some of soulomoon's feedback
* Fix small issues
* Remove unused imports
* Remove StructuredDiagnostic
* Revert "Remove StructuredDiagnostic"
This reverts commit 0776c65.
* Remove the unused parameter from 'ideErrorText'
* Add documentation to diagnostic helpers
* Add action to query active diagnostics for a given Range
Implement 'rangesOverlap' function which checks whether two 'Range's
overlap in any way.
Implement two new plugin utility functions which allow to conveniently
get all currently displayed diagnostics for a given 'Range'.
* Use lens for updating Diagnostic
* Add GHC Structured Error compatibility module
Add compatibility module for GHC's structured error messages.
Introduce 'Prism's and 'Lens's to easily access nested structures.
Expand documentation for 'StructuredMessage'
* Remove unused imports
* Don't suggest -Wno-deferred-out-of-scope-variables (#4441)
Fixes #4440
Fixes test for disabling deferred-type-errors.
* Build HLS with GHC 9.8.3 (#4444)
* ci(mergify): upgrade configuration to current format (#4454)
Co-authored-by: Mergify <37929162+mergify[bot]@users.noreply.github.com>
* More tests and better docs for cabal-add (#4455)
* new tests
* change codeAction title
* more tests and docs
---------
Co-authored-by: fendor <[email protected]>
* Fix compatibility with GHC 9.4 and rename function
* Use GHC Note syntax and reference Note in docs
Allows HLS to 'Goto Definition' for Note references.
* Add doc comment for 'tmrWarnings'
* Push CPP statements to compatibility module
* Fix formatting in Development.IDE.GHC.Compat.Error
---------
Co-authored-by: Dylan Thinnes <[email protected]>
Co-authored-by: soulomoon <[email protected]>
Co-authored-by: Fendor <[email protected]>
Co-authored-by: jeukshi <[email protected]>
Co-authored-by: fendor <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Georgii Gerasev <[email protected]>1 parent f09500b commit b87bdb9
File tree
46 files changed
+982
-358
lines changed- ghcide-bench/src
- ghcide
- session-loader/Development/IDE
- Session
- src
- Development/IDE
- Core
- GHC
- Compat
- Import
- Plugin
- Types
- Text/Fuzzy
- test/exe
- hls-plugin-api/src/Ide
- hls-test-utils/src/Development/IDE
- Test
- plugins
- hls-cabal-plugin/src/Ide/Plugin/Cabal
- hls-hlint-plugin/src/Ide/Plugin
- hls-pragmas-plugin/src/Ide/Plugin
- hls-refactor-plugin
- src/Development/IDE/Plugin
- test
- hls-stan-plugin/src/Ide/Plugin
- test/functional
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
46 files changed
+982
-358
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
| 269 | + | |
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| 154 | + | |
153 | 155 | | |
| 156 | + | |
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
580 | 581 | | |
581 | 582 | | |
582 | 583 | | |
| |||
797 | 798 | | |
798 | 799 | | |
799 | 800 | | |
800 | | - | |
| 801 | + | |
801 | 802 | | |
802 | | - | |
803 | | - | |
| 803 | + | |
| 804 | + | |
804 | 805 | | |
805 | 806 | | |
806 | 807 | | |
| |||
875 | 876 | | |
876 | 877 | | |
877 | 878 | | |
878 | | - | |
879 | | - | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
880 | 890 | | |
881 | | - | |
| 891 | + | |
882 | 892 | | |
883 | 893 | | |
884 | 894 | | |
| |||
1223 | 1233 | | |
1224 | 1234 | | |
1225 | 1235 | | |
1226 | | - | |
| 1236 | + | |
1227 | 1237 | | |
1228 | | - | |
| 1238 | + | |
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| 134 | + | |
| 135 | + | |
133 | 136 | | |
134 | 137 | | |
135 | 138 | | |
| |||
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
160 | | - | |
161 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
162 | 169 | | |
163 | 170 | | |
164 | 171 | | |
| |||
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
182 | | - | |
| 189 | + | |
183 | 190 | | |
184 | | - | |
185 | | - | |
186 | | - | |
| 191 | + | |
| 192 | + | |
187 | 193 | | |
188 | 194 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 195 | + | |
193 | 196 | | |
194 | | - | |
195 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
196 | 207 | | |
197 | 208 | | |
198 | 209 | | |
| |||
358 | 369 | | |
359 | 370 | | |
360 | 371 | | |
361 | | - | |
| 372 | + | |
362 | 373 | | |
363 | | - | |
| 374 | + | |
364 | 375 | | |
365 | 376 | | |
366 | 377 | | |
| |||
372 | 383 | | |
373 | 384 | | |
374 | 385 | | |
375 | | - | |
| 386 | + | |
376 | 387 | | |
377 | 388 | | |
378 | 389 | | |
| |||
535 | 546 | | |
536 | 547 | | |
537 | 548 | | |
538 | | - | |
539 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
540 | 557 | | |
541 | 558 | | |
542 | 559 | | |
| |||
660 | 677 | | |
661 | 678 | | |
662 | 679 | | |
663 | | - | |
664 | | - | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
665 | 683 | | |
666 | 684 | | |
667 | 685 | | |
668 | 686 | | |
669 | | - | |
| 687 | + | |
670 | 688 | | |
671 | | - | |
| 689 | + | |
672 | 690 | | |
673 | 691 | | |
674 | 692 | | |
| |||
692 | 710 | | |
693 | 711 | | |
694 | 712 | | |
695 | | - | |
| 713 | + | |
696 | 714 | | |
697 | | - | |
698 | | - | |
| 715 | + | |
| 716 | + | |
699 | 717 | | |
700 | | - | |
| 718 | + | |
701 | 719 | | |
702 | | - | |
| 720 | + | |
703 | 721 | | |
704 | | - | |
| 722 | + | |
705 | 723 | | |
706 | | - | |
| 724 | + | |
707 | 725 | | |
708 | 726 | | |
709 | 727 | | |
| |||
859 | 877 | | |
860 | 878 | | |
861 | 879 | | |
862 | | - | |
863 | | - | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
864 | 885 | | |
865 | 886 | | |
866 | 887 | | |
867 | 888 | | |
868 | 889 | | |
869 | 890 | | |
870 | | - | |
871 | | - | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
872 | 899 | | |
873 | 900 | | |
874 | 901 | | |
| |||
1048 | 1075 | | |
1049 | 1076 | | |
1050 | 1077 | | |
1051 | | - | |
| 1078 | + | |
1052 | 1079 | | |
1053 | 1080 | | |
1054 | 1081 | | |
| |||
1062 | 1089 | | |
1063 | 1090 | | |
1064 | 1091 | | |
1065 | | - | |
| 1092 | + | |
1066 | 1093 | | |
1067 | | - | |
| 1094 | + | |
1068 | 1095 | | |
1069 | 1096 | | |
1070 | 1097 | | |
| |||
1081 | 1108 | | |
1082 | 1109 | | |
1083 | 1110 | | |
1084 | | - | |
| 1111 | + | |
| 1112 | + | |
1085 | 1113 | | |
1086 | 1114 | | |
1087 | 1115 | | |
1088 | 1116 | | |
1089 | 1117 | | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | | - | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
1096 | 1133 | | |
1097 | 1134 | | |
1098 | 1135 | | |
| |||
1106 | 1143 | | |
1107 | 1144 | | |
1108 | 1145 | | |
1109 | | - | |
1110 | | - | |
| 1146 | + | |
1111 | 1147 | | |
1112 | 1148 | | |
1113 | 1149 | | |
| |||
1137 | 1173 | | |
1138 | 1174 | | |
1139 | 1175 | | |
1140 | | - | |
1141 | | - | |
| 1176 | + | |
| 1177 | + | |
1142 | 1178 | | |
1143 | 1179 | | |
1144 | 1180 | | |
| |||
0 commit comments