, (<|>)
, satisfy
-- * Utilities
+ , openDoc
, getDocItem
, getDocUri
) where
h <- serverIn <$> ask
liftIO $ B.hPut h $ addHeader (encode msg)
+-- | Opens a text document and sends a notification to the client.
+openDoc :: FilePath -> String -> Session TextDocumentIdentifier
+openDoc file languageId = do
+ item <- getDocItem file languageId
+ sendNotification TextDocumentDidOpen (DidOpenTextDocumentParams item)
+ TextDocumentIdentifier <$> getDocUri file
+
-- | Reads in a text document as the first version.
getDocItem :: FilePath -- ^ The path to the text document to read in.
-> String -- ^ The language ID, e.g "haskell" for .hs files.
describe "manual session validation" $
it "passes a test" $
runSession "test/recordings/renamePass" $ do
- docItem <- getDocItem "Desktop/simple.hs" "haskell"
- docId <- TextDocumentIdentifier <$> getDocUri "Desktop/simple.hs"
-
- sendNotification TextDocumentDidOpen (DidOpenTextDocumentParams docItem)
+ doc <- openDoc "Desktop/simple.hs" "haskell"
skipMany loggingNotification
sendRequest (Proxy :: Proxy DocumentSymbolRequest)
TextDocumentDocumentSymbol
- (DocumentSymbolParams docId)
+ (DocumentSymbolParams doc)
RspDocumentSymbols rspSymbols <- response