X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=example%2FMain.hs;h=1e2e3baf3356b36f6eb09967a02ce2e7fbd12c0a;hb=cdb1ba7038c32bac71a3bc783effc1e07049a985;hp=29795fa22e52b76279d1ae98eca5c5f111eb72cd;hpb=7d0ddb8022d9cccc68a99008dd55c1d39ddda3e7;p=lsp-test.git diff --git a/example/Main.hs b/example/Main.hs index 29795fa..1e2e3ba 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 "hie --lsp" "test/recordings/renamePass" $ do - - docItem <- getDocItem "Desktop/simple.hs" "haskell" - docId <- TextDocumentIdentifier <$> getDocUri "Desktop/simple.hs" +main = runSession "hie --lsp" fullCaps "test/data/renamePass" $ do + docItem <- openDoc "Desktop/simple.hs" "haskell" - sendNotification TextDocumentDidOpen (DidOpenTextDocumentParams docItem) + -- Use your favourite favourite combinators. + skipManyTill loggingNotification (count 2 publishDiagnosticsNotification) - sendRequest TextDocumentDocumentSymbol (DocumentSymbolParams docId) + -- Send requests and notifications and receive responses + let params = DocumentSymbolParams docItem + rsp <- request TextDocumentDocumentSymbol params :: Session DocumentSymbolsResponse + liftIO $ print rsp - skipMany loggingNotification + -- Or use one of the helper functions + getDocumentSymbols docItem >>= liftIO . print - anyResponse >>= liftIO . print