X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=example%2FMain.hs;h=7ee3f92cd414db960a5b14d98d3804d1745c6995;hb=f0d93bbe47d55ab650909e0487c65c1048f1bb9a;hp=cc74026531ead6183d384d9113fd001a8f60e510;hpb=d8e460543b7cbc32550bed20d20ef4b13d6705a5;p=lsp-test.git diff --git a/example/Main.hs b/example/Main.hs index cc74026..7ee3f92 100644 --- a/example/Main.hs +++ b/example/Main.hs @@ -1,14 +1,19 @@ -import Language.Haskell.LSP.Test -import Language.Haskell.LSP.TH.DataTypesJSON - +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 +main = runSession "hie --lsp" fullCaps "test/data/renamePass" $ do docItem <- openDoc "Desktop/simple.hs" "haskell" + -- Use your favourite favourite combinators. + skipManyTill loggingNotification (count 2 publishDiagnosticsNotification) + + -- Send requests and notifications and receive responses let params = DocumentSymbolParams docItem - _ <- sendRequest TextDocumentDocumentSymbol params :: Session DocumentSymbolsResponse + response <- sendRequest TextDocumentDocumentSymbol params :: Session DocumentSymbolsResponse + liftIO $ print response - skipMany loggingNotification + -- Or use one of the helper functions + getDocumentSymbols docItem >>= liftIO . print - anyResponse >>= liftIO . print