X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=example%2FMain.hs;h=0318ce8c04f47243f3946bd1d755c336cc08e3e7;hb=0e9ea704c2fd5ab6c762e709b4a4ad4b10169a7e;hp=d66e17e11075f0f018e7ee8a37eaf4410734212a;hpb=f1238f8db54eafbf0e3352140818875ad4cfd997;p=opengl.git diff --git a/example/Main.hs b/example/Main.hs index d66e17e..0318ce8 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 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 - skipMany loggingNotification - - response >>= liftIO . print \ No newline at end of file