Rename sendRequest to request, sendRequest' to sendRequest
[opengl.git] / example / Main.hs
index 1697ca53d90cd51b2144b2d438efbc00ab568c70..1e2e3baf3356b36f6eb09967a02ce2e7fbd12c0a 100644 (file)
@@ -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 "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