X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=example%2FMain.hs;h=c992b8ea67390760497b6fdee187078c428489a8;hb=c6e68648c1e3b586e1ee8b0dcda1485ff5ae28ba;hp=d66e17e11075f0f018e7ee8a37eaf4410734212a;hpb=f1238f8db54eafbf0e3352140818875ad4cfd997;p=lsp-test.git diff --git a/example/Main.hs b/example/Main.hs index d66e17e..c992b8e 100644 --- a/example/Main.hs +++ b/example/Main.hs @@ -1,18 +1,19 @@ -import Language.Haskell.LSP.Test -import Language.Haskell.LSP.TH.DataTypesJSON -import Data.Proxy - +import Control.Applicative.Combinators import Control.Monad.IO.Class +import Language.Haskell.LSP.Test +import Language.Haskell.LSP.Types -main = runSession "test/recordings/renamePass" $ do - - docItem <- getDocItem "Desktop/simple.hs" "haskell" - docId <- TextDocumentIdentifier <$> getDocUri "Desktop/simple.hs" +main = runSession "hie --lsp" "test/recordings/renamePass" $ do + docItem <- openDoc "Desktop/simple.hs" "haskell" - sendNotification TextDocumentDidOpen (DidOpenTextDocumentParams docItem) + -- Use your favourite favourite combinators. + skipManyTill loggingNotification (count 2 publishDiagnosticsNotification) - sendRequest (Proxy :: Proxy DocumentSymbolRequest) TextDocumentDocumentSymbol (DocumentSymbolParams docId) + -- Send requests and notifications and receive responses + let params = DocumentSymbolParams docItem + response <- sendRequest TextDocumentDocumentSymbol params :: Session DocumentSymbolsResponse + liftIO $ print response - skipMany loggingNotification + -- Or use one of the helper functions + getDocumentSymbols docItem >>= liftIO . print - response >>= liftIO . print \ No newline at end of file