X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=example%2FMain.hs;h=0318ce8c04f47243f3946bd1d755c336cc08e3e7;hb=0e9ea704c2fd5ab6c762e709b4a4ad4b10169a7e;hp=5aaa2d13abee6adb516dcfece381e3cd215d1e50;hpb=df782ad008b840c0860173821226542e2e70f2e9;p=lsp-test.git diff --git a/example/Main.hs b/example/Main.hs index 5aaa2d1..0318ce8 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 Language.Haskell.LSP.Types import Control.Monad.IO.Class -main = runSession "test/recordings/renamePass" $ do +main = runSession "hie --lsp" "test/recordings/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 + response <- sendRequest TextDocumentDocumentSymbol params :: Session DocumentSymbolsResponse + liftIO $ print response - 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