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.Types
10 import Language.Haskell.LSP.Messages
13 describe "manual session validation" $
15 runSession "test/recordings/renamePass" $ do
16 docItem <- getDocItem "Desktop/simple.hs" "haskell"
17 docId <- TextDocumentIdentifier <$> getDocUri "Desktop/simple.hs"
19 sendNotification TextDocumentDidOpen (DidOpenTextDocumentParams docItem)
21 skipMany loggingNotification
23 (NotPublishDiagnostics (NotificationMessage _ TextDocumentPublishDiagnostics (PublishDiagnosticsParams _ (List diags)))) <- notification
25 liftIO $ diags `shouldBe` []
27 sendRequest (Proxy :: Proxy DocumentSymbolRequest)
28 TextDocumentDocumentSymbol
29 (DocumentSymbolParams docId)
31 (RspDocumentSymbols (ResponseMessage _ _ (Just (List symbols)) Nothing)) <- response
34 let mainSymbol = head symbols
35 mainSymbol ^. name `shouldBe` "main"
36 mainSymbol ^. kind `shouldBe` SkFunction
37 mainSymbol ^. location . range `shouldBe` Range (Position 3 0) (Position 3 4)
38 mainSymbol ^. containerName `shouldBe` Nothing
40 describe "replay session" $
42 replaySession "test/recordings/renamePass" `shouldReturn` True