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 @@ -96,6 +96,32 @@ hlintTests = testGroup "hlint suggestions" [
9696
9797 liftIO $ Just " hlint" `notElem` map (^. L. source) diags' @? " There are no hlint diagnostics"
9898
99+ , testCase " changing document contents updates hlint diagnostics" $ runSession hlsCommand fullCaps " test/testdata/hlint" $ do
100+ doc <- openDoc " ApplyRefact2.hs" " haskell"
101+ diags <- waitForDiagnosticsSource " hlint"
102+
103+ liftIO $ length diags @?= 2 -- "Eta Reduce" and "Redundant Id"
104+
105+ let change = TextDocumentContentChangeEvent
106+ (Just (Range (Position 1 8 ) (Position 1 12 )))
107+ Nothing " x"
108+
109+ changeDoc doc [change]
110+
111+ diags' <- waitForDiagnostics
112+
113+ liftIO $ (not $ Just " hlint" `elem` map (^. L. source) diags') @? " There are no hlint diagnostics"
114+
115+ let change' = TextDocumentContentChangeEvent
116+ (Just (Range (Position 1 8 ) (Position 1 12 )))
117+ Nothing " id x"
118+
119+ changeDoc doc [change']
120+
121+ diags'' <- waitForDiagnosticsSource " hlint"
122+
123+ liftIO $ length diags'' @?= 2
124+
99125 , testCase " apply hints works with LambdaCase" $ runSession hlsCommand fullCaps " test/testdata/hlint" $ do
100126 doc <- openDoc " ApplyRefact1.hs" " haskell"
101127 diags <- waitForDiagnosticsSource " hlint"
You can’t perform that action at this time.
0 commit comments