Skip to content

Commit 1892c8f

Browse files
authored
Fix several hlint issues related with the use of parsed module without comments (#2366)
* Replace * with - * Use parsed module with comments * Correct issue id * Remove unknown broken for #638, #2042 and #2280
1 parent 311107e commit 1892c8f

File tree

3 files changed

+33
-36
lines changed

3 files changed

+33
-36
lines changed

ChangeLog.md

+28-28
Original file line numberDiff line numberDiff line change
@@ -701,34 +701,34 @@ Here are the summary of changes:
701701
Haskell Language Server 1.1.0 has finally come! Many thanks to all contributors -- since the last release, we have merged over 100 PRs!
702702
As always, there are many internal bug fixes and performance improvements in ghcide. Apart from that,
703703

704-
* Wingman gets many enhancements, thanks to @isovector for this epic work!
705-
* Wingman actions can now be bound to editor hotkeys
706-
* Experimental support for "jump to next unsolved hole"
707-
* Improved layout algorithm --- don't reflow instances, or break do-blocks
708-
* Wingman can now deal with GADTs, rank-n types and pattern synonyms
709-
* Wingman now respects user-written bindings on the left side of the equals sign
710-
* Significantly more-natural synthesized code when dealing with newtypes, infix operators, records and strings
711-
* Improved user experience --- less waiting, and friendly errors for when things go wrong
712-
* hlint plugin not working in some cases gets fixed
713-
* annoying log message "haskell-lsp:incoming message parse error" gets fixed in `lsp-1.2`
714-
* eval plugin now supports `it` variable, like GHCi
715-
* verbose message "No cradle found for ... Proceeding with implicit cradle" is GONE
716-
* type lenses plugin now has its custom config `mode` (enum) [`always`] to control its working mode:
717-
* `always`: always displays type signature lenses of global bindings
718-
* `exported`: similar to `always`, but only displays for exported global bindings
719-
* `diagnostics`: follows diagnostic messages produced by GHC
720-
* top-level LSP option `completionSnippetsOn` and `maxNumberOfProblems` are deprecated
721-
* completions plugin now has its custom config:
722-
* `autoExtendOn` (boolean) [`true`]: whether to enable auto extending import lists
723-
* `snippetsOn` (boolean) [`true`]: wheter to enable completion snippets, taking the place of `completionSnippetsOn`
724-
* Wingman has its custom config:
725-
* `timeout_duration` (integer) [`2`]: the timeout for Wingman actions, in seconds
726-
* `features` (string) [`""`]: feature set used by Wingman (See [the README of Wingman](https://github.com/haskell/haskell-language-server/tree/master/plugins/hls-tactics-plugin#readme))
727-
* `max_use_ctor_actions` (integer) [`5`]: maximum number of `Use constructor <x>` code actions that can appear
728-
* `hole_severity` (enum) [`none`]: the severity to use when showing hole diagnostics
729-
* LSP symbols of typeclass and type families are more appropriate
730-
* test suite of plugins are reorganized, which no longer need to be run with `test-server` executable
731-
* two new packages `hls-test-utils` and `hls-stylish-haskell-plugin` are extracted
704+
- Wingman gets many enhancements, thanks to @isovector for this epic work!
705+
- Wingman actions can now be bound to editor hotkeys
706+
- Experimental support for "jump to next unsolved hole"
707+
- Improved layout algorithm --- don't reflow instances, or break do-blocks
708+
- Wingman can now deal with GADTs, rank-n types and pattern synonyms
709+
- Wingman now respects user-written bindings on the left side of the equals sign
710+
- Significantly more-natural synthesized code when dealing with newtypes, infix operators, records and strings
711+
- Improved user experience --- less waiting, and friendly errors for when things go wrong
712+
- hlint plugin not working in some cases gets fixed
713+
- annoying log message "haskell-lsp:incoming message parse error" gets fixed in `lsp-1.2`
714+
- eval plugin now supports `it` variable, like GHCi
715+
- verbose message "No cradle found for ... Proceeding with implicit cradle" is GONE
716+
- type lenses plugin now has its custom config `mode` (enum) [`always`] to control its working mode:
717+
- `always`: always displays type signature lenses of global bindings
718+
- `exported`: similar to `always`, but only displays for exported global bindings
719+
- `diagnostics`: follows diagnostic messages produced by GHC
720+
- top-level LSP option `completionSnippetsOn` and `maxNumberOfProblems` are deprecated
721+
- completions plugin now has its custom config:
722+
- `autoExtendOn` (boolean) [`true`]: whether to enable auto extending import lists
723+
- `snippetsOn` (boolean) [`true`]: wheter to enable completion snippets, taking the place of `completionSnippetsOn`
724+
- Wingman has its custom config:
725+
- `timeout_duration` (integer) [`2`]: the timeout for Wingman actions, in seconds
726+
- `features` (string) [`""`]: feature set used by Wingman (See [the README of Wingman](https://github.com/haskell/haskell-language-server/tree/master/plugins/hls-tactics-plugin#readme))
727+
- `max_use_ctor_actions` (integer) [`5`]: maximum number of `Use constructor <x>` code actions that can appear
728+
- `hole_severity` (enum) [`none`]: the severity to use when showing hole diagnostics
729+
- LSP symbols of typeclass and type families are more appropriate
730+
- test suite of plugins are reorganized, which no longer need to be run with `test-server` executable
731+
- two new packages `hls-test-utils` and `hls-stylish-haskell-plugin` are extracted
732732

733733
This version uses `lsp-1.2.0`, `hls-plugin-api-1.1.0`, and `ghcide-1.2.0.2`.
734734

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,14 @@ getIdeas nfp = do
237237
where moduleEx :: ParseFlags -> Action (Maybe (Either ParseError ModuleEx))
238238
#ifndef HLINT_ON_GHC_LIB
239239
moduleEx _flags = do
240-
mbpm <- getParsedModule nfp
240+
mbpm <- getParsedModuleWithComments nfp
241241
return $ createModule <$> mbpm
242242
where createModule pm = Right (createModuleEx anns modu)
243243
where anns = pm_annotations pm
244244
modu = pm_parsed_source pm
245245
#else
246246
moduleEx flags = do
247-
mbpm <- getParsedModule nfp
247+
mbpm <- getParsedModuleWithComments nfp
248248
-- If ghc was not able to parse the module, we disable hlint diagnostics
249249
if isNothing mbpm
250250
then return Nothing

plugins/hls-hlint-plugin/test/Main.hs

+3-6
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ suggestionsTests =
131131
doc <- openDoc "IgnoreAnn.hs" "haskell"
132132
expectNoMoreDiagnostics 3 doc "hlint"
133133

134-
, knownBrokenForHlintOnRawGhc "[#838] hlint plugin doesn't honour HLINT annotations" $
135-
testCase "hlint diagnostics ignore hints honouring HLINT annotations" $ runHlintSession "" $ do
134+
, testCase "hlint diagnostics ignore hints honouring HLINT annotations" $ runHlintSession "" $ do
136135
doc <- openDoc "IgnoreAnnHlint.hs" "haskell"
137136
expectNoMoreDiagnostics 3 doc "hlint"
138137

@@ -158,8 +157,7 @@ suggestionsTests =
158157
liftIO $ not (hasApplyAll thirdLine) @? "Unexpected apply all code action"
159158
liftIO $ hasApplyAll multiLine @? "Missing apply all code action"
160159

161-
, knownBrokenForHlintOnRawGhc "[#2042] maybe hlint is ignoring pragmas" $
162-
testCase "hlint should warn about unused extensions" $ runHlintSession "unusedext" $ do
160+
, testCase "hlint should warn about unused extensions" $ runHlintSession "unusedext" $ do
163161
doc <- openDoc "UnusedExtension.hs" "haskell"
164162
diags@(unusedExt:_) <- waitForDiagnosticsFromSource doc "hlint"
165163

@@ -174,8 +172,7 @@ suggestionsTests =
174172
waitForAllProgressDone
175173
-- hlint will report a parse error if PatternSynonyms is enabled
176174
expectNoMoreDiagnostics 3 doc "hlint"
177-
, knownBrokenForHlintOnRawGhc "[#2280] maybe hlint is ignoring pragmas" $
178-
testCase "hlint should not warn about redundant irrefutable pattern with LANGUAGE Strict" $ runHlintSession "" $ do
175+
, testCase "hlint should not warn about redundant irrefutable pattern with LANGUAGE Strict" $ runHlintSession "" $ do
179176
doc <- openDoc "StrictData.hs" "haskell"
180177

181178
waitForAllProgressDone

0 commit comments

Comments
 (0)