X-Git-Url: https://git.lukelau.me/?a=blobdiff_plain;f=example%2FMain.hs;h=1e2e3baf3356b36f6eb09967a02ce2e7fbd12c0a;hb=d1855cd1182c51333c82bf964fc96c8ec3ec76b7;hp=5aaa2d13abee6adb516dcfece381e3cd215d1e50;hpb=df782ad008b840c0860173821226542e2e70f2e9;p=lsp-test.git diff --git a/example/Main.hs b/example/Main.hs index 5aaa2d1..1e2e3ba 100644 --- a/example/Main.hs +++ b/example/Main.hs @@ -1,17 +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 +main = runSession "hie --lsp" fullCaps "test/data/renamePass" $ do + docItem <- openDoc "Desktop/simple.hs" "haskell" - docItem <- getDocItem "Desktop/simple.hs" "haskell" - docId <- TextDocumentIdentifier <$> getDocUri "Desktop/simple.hs" + -- Use your favourite favourite combinators. + skipManyTill loggingNotification (count 2 publishDiagnosticsNotification) - sendNotification TextDocumentDidOpen (DidOpenTextDocumentParams docItem) + -- Send requests and notifications and receive responses + let params = DocumentSymbolParams docItem + rsp <- request TextDocumentDocumentSymbol params :: Session DocumentSymbolsResponse + liftIO $ print rsp - sendRequest (Proxy :: Proxy DocumentSymbolRequest) TextDocumentDocumentSymbol (DocumentSymbolParams docId) + -- Or use one of the helper functions + getDocumentSymbols docItem >>= liftIO . print - syms <- getMessage :: Session DocumentSymbolsResponse - liftIO $ print syms \ No newline at end of file