1 {-# LANGUAGE DuplicateRecordFields #-}
2 {-# LANGUAGE OverloadedStrings #-}
5 import Control.Monad.IO.Class
6 import Control.Lens hiding (List)
7 import Language.Haskell.LSP.Test
8 import Language.Haskell.LSP.Test.Replay
9 import Language.Haskell.LSP.TH.DataTypesJSON
12 describe "manual session validation" $
14 runSession "test/recordings/renamePass" $ do
15 docItem <- getDocItem "Desktop/simple.hs" "haskell"
16 docId <- TextDocumentIdentifier <$> getDocUri "Desktop/simple.hs"
18 sendNotification TextDocumentDidOpen (DidOpenTextDocumentParams docItem)
20 (NotificationMessage _ TextDocumentPublishDiagnostics (PublishDiagnosticsParams _ (List diags))) <-
21 getMessage :: Session PublishDiagnosticsNotification
23 liftIO $ diags `shouldBe` []
25 sendRequest (Proxy :: Proxy DocumentSymbolRequest)
26 TextDocumentDocumentSymbol
27 (DocumentSymbolParams docId)
29 (ResponseMessage _ _ (Just (List symbols)) Nothing) <- getMessage :: Session DocumentSymbolsResponse
31 let mainSymbol = head symbols
32 mainSymbol ^. name `shouldBe` "main"
33 mainSymbol ^. kind `shouldBe` SkFunction
34 mainSymbol ^. location . range `shouldBe` Range (Position 3 0) (Position 3 4)
35 mainSymbol ^. containerName `shouldBe` Nothing
37 describe "replay session" $
39 replaySession "test/recordings/renamePass" `shouldReturn` True