Skip to content

Commit

Permalink
Add reproduction for #2290
Browse files Browse the repository at this point in the history
  • Loading branch information
jneira committed Nov 5, 2021
1 parent 92f776d commit ebd9445
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/hls-hlint-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ suggestionsTests =
, testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
testRefactor "Comments.hs" "Redundant bracket" expectedComments

, testCase "[#2290] apply all hints works with a trailing comment" $ runHlintSession "" $ do
testRefactor "TwoHintsAndComment.hs" "Apply all hints" expectedComments2

, testCase "applyAll is shown only when there is at least one diagnostic in range" $ runHlintSession "" $ do
doc <- openDoc "TwoHints.hs" "haskell"
_ <- waitForDiagnosticsFromSource doc "hlint"
Expand Down Expand Up @@ -212,6 +215,9 @@ suggestionsTests =
, "f = {- inline comment -}{- inline comment inside refactored code -} 1 -- ending comment", ""
, "-- final comment"
]
expectedComments2 = [ "module TwoHintsAndComment where"
, "biggest items = foldr1 max -- the line above will show two hlint hints, \"eta reduce\" and \"use maximum\""
]
expectedTypeApp = [ "module TypeApplication where", ""
, "a = id @Int 1"
]
Expand Down
3 changes: 3 additions & 0 deletions plugins/hls-hlint-plugin/test/testdata/TwoHintsAndComment.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module TwoHintsAndComments where

biggest items = foldr1 max items -- the line above will show two hlint hints, "eta reduce" and "use maximum"
1 change: 1 addition & 0 deletions plugins/hls-hlint-plugin/test/testdata/hie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ cradle:
- "TwoHints"
- "PatternKeyword"
- "StrictData"
- "TwoHintsAndComment"

0 comments on commit ebd9445

Please sign in to comment.