1 {-# LANGUAGE DuplicateRecordFields #-}
2 {-# LANGUAGE OverloadedStrings #-}
6 import Control.Monad.IO.Class
7 import Control.Lens hiding (List)
8 import Language.Haskell.LSP.Test
9 import Language.Haskell.LSP.Test.Replay
10 import Language.Haskell.LSP.Types
11 import Language.Haskell.LSP.Messages
14 describe "manual session validation" $
16 runSession "test/recordings/renamePass" $ do
17 doc <- openDoc "Desktop/simple.hs" "haskell"
19 skipMany loggingNotification
21 NotPublishDiagnostics diagsNot <- notification
23 liftIO $ diagsNot ^. params . diagnostics `shouldBe` List []
25 sendRequest (Proxy :: Proxy DocumentSymbolRequest)
26 TextDocumentDocumentSymbol
27 (DocumentSymbolParams doc)
29 RspDocumentSymbols rspSymbols <- response
32 let (List symbols) = fromJust (rspSymbols ^. result)
33 mainSymbol = head symbols
34 mainSymbol ^. name `shouldBe` "main"
35 mainSymbol ^. kind `shouldBe` SkFunction
36 mainSymbol ^. location . range `shouldBe` Range (Position 3 0) (Position 3 4)
37 mainSymbol ^. containerName `shouldBe` Nothing
39 describe "replay session" $
41 replaySession "test/recordings/renamePass" `shouldReturn` True