Upgrade stack to lts-12.0
[opengl.git] / example / Main.hs
index 0c8ae9ff821618ee85f198decd3170e199e391ed..0318ce8c04f47243f3946bd1d755c336cc08e3e7 100644 (file)
@@ -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 "hie" "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