Skip to content

Commit

Permalink
Fix several hlint issues related with the use of parsed module withou…
Browse files Browse the repository at this point in the history
…t comments (#2366)

* Replace * with -

* Use parsed module with comments

* Correct issue id

* Remove unknown broken for #638, #2042 and #2280
  • Loading branch information
jneira authored Nov 19, 2021
1 parent 311107e commit 1892c8f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 36 deletions.
56 changes: 28 additions & 28 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -701,34 +701,34 @@ Here are the summary of changes:
Haskell Language Server 1.1.0 has finally come! Many thanks to all contributors -- since the last release, we have merged over 100 PRs!
As always, there are many internal bug fixes and performance improvements in ghcide. Apart from that,

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

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

Expand Down
4 changes: 2 additions & 2 deletions plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ getIdeas nfp = do
where moduleEx :: ParseFlags -> Action (Maybe (Either ParseError ModuleEx))
#ifndef HLINT_ON_GHC_LIB
moduleEx _flags = do
mbpm <- getParsedModule nfp
mbpm <- getParsedModuleWithComments nfp
return $ createModule <$> mbpm
where createModule pm = Right (createModuleEx anns modu)
where anns = pm_annotations pm
modu = pm_parsed_source pm
#else
moduleEx flags = do
mbpm <- getParsedModule nfp
mbpm <- getParsedModuleWithComments nfp
-- If ghc was not able to parse the module, we disable hlint diagnostics
if isNothing mbpm
then return Nothing
Expand Down
9 changes: 3 additions & 6 deletions plugins/hls-hlint-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ suggestionsTests =
doc <- openDoc "IgnoreAnn.hs" "haskell"
expectNoMoreDiagnostics 3 doc "hlint"

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

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

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

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

waitForAllProgressDone
Expand Down

0 comments on commit 1892c8f

Please sign in to comment.