File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,32 @@ hlintTests = testGroup "hlint suggestions" [
98
98
99
99
liftIO $ Just " hlint" `notElem` map (^. L. source) diags' @? " There are no hlint diagnostics"
100
100
101
+ , testCase " changing document contents updates hlint diagnostics" $ runSession hlsCommand fullCaps " test/testdata/hlint" $ do
102
+ doc <- openDoc " ApplyRefact2.hs" " haskell"
103
+ diags <- waitForDiagnosticsSource " hlint"
104
+
105
+ liftIO $ length diags @?= 2 -- "Eta Reduce" and "Redundant Id"
106
+
107
+ let change = TextDocumentContentChangeEvent
108
+ (Just (Range (Position 1 8 ) (Position 1 12 )))
109
+ Nothing " x"
110
+
111
+ changeDoc doc [change]
112
+
113
+ diags' <- waitForDiagnostics
114
+
115
+ liftIO $ (not $ Just " hlint" `elem` map (^. L. source) diags') @? " There are no hlint diagnostics"
116
+
117
+ let change' = TextDocumentContentChangeEvent
118
+ (Just (Range (Position 1 8 ) (Position 1 12 )))
119
+ Nothing " id x"
120
+
121
+ changeDoc doc [change']
122
+
123
+ diags'' <- waitForDiagnosticsSource " hlint"
124
+
125
+ liftIO $ length diags'' @?= 2
126
+
101
127
, testCase " apply hints works with LambdaCase" $ runSession hlsCommand fullCaps " test/testdata/hlint" $ do
102
128
doc <- openDoc " ApplyRefact1.hs" " haskell"
103
129
diags <- waitForDiagnosticsSource " hlint"
You can’t perform that action at this time.
0 commit comments