@@ -21,46 +21,31 @@ spec :: Spec
21
21
spec = describe " liquid haskell diagnostics" $ do
22
22
it " runs diagnostics on save, no liquid" $
23
23
runSession hieCommandExamplePlugin codeActionSupportCaps " test/testdata" $ do
24
- -- runSessionWithConfig logConfig hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
25
24
doc <- openDoc " liquid/Evens.hs" " haskell"
26
25
27
26
diags@ (reduceDiag: _) <- waitForDiagnostics
28
27
29
- -- liftIO $ show diags `shouldBe` ""
30
- -- liftIO $ putStrLn "a"
31
-
32
28
liftIO $ do
33
29
length diags `shouldBe` 2
34
30
reduceDiag ^. range `shouldBe` Range (Position 5 18 ) (Position 5 22 )
35
31
reduceDiag ^. severity `shouldBe` Just DsHint
36
32
reduceDiag ^. code `shouldBe` Just (StringValue " Use negate" )
37
33
reduceDiag ^. source `shouldBe` Just " hlint"
38
34
39
- -- liftIO $ putStrLn "b"
40
-
41
35
diags2hlint <- waitForDiagnostics
42
- -- liftIO $ putStrLn "c"
43
- -- liftIO $ show diags2hlint `shouldBe` ""
36
+
44
37
liftIO $ length diags2hlint `shouldBe` 2
45
38
46
- -- docItem <- getDocItem file languageId
47
39
sendNotification TextDocumentDidSave (DidSaveTextDocumentParams doc)
48
40
49
- -- diags2liquid <- waitForDiagnostics
50
- -- liftIO $ putStrLn "d"
51
- -- liftIO $ length diags2liquid `shouldBe` 3
52
- -- -- liftIO $ show diags2liquid `shouldBe` ""
53
-
54
- diags3@ (d: _) <- waitForDiagnostics
55
- -- liftIO $ putStrLn "e"
56
- -- liftIO $ show diags3 `shouldBe` ""
41
+ diags3@ (d: _) <- waitForDiagnosticsSource " eg2"
42
+
57
43
liftIO $ do
58
- length diags3 `shouldBe` 3
59
- d ^. range `shouldBe` Range (Position 0 0 ) (Position 1 0 )
60
- d ^. severity `shouldBe` Nothing
61
- d ^. code `shouldBe` Nothing
62
- d ^. source `shouldBe` Just " eg2"
63
- d ^. message `shouldBe` (T. pack " Example plugin diagnostic, triggered byDiagnosticOnSave" )
44
+ length diags3 `shouldBe` 1
45
+ d ^. LSP. range `shouldBe` Range (Position 0 0 ) (Position 1 0 )
46
+ d ^. LSP. severity `shouldBe` Nothing
47
+ d ^. LSP. code `shouldBe` Nothing
48
+ d ^. LSP. message `shouldBe` T. pack " Example plugin diagnostic, triggered byDiagnosticOnSave"
64
49
65
50
-- ---------------------------------
66
51
0 commit comments