X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=example%2FMain.hs;h=0318ce8c04f47243f3946bd1d755c336cc08e3e7;hb=0e9ea704c2fd5ab6c762e709b4a4ad4b10169a7e;hp=4dd268c907d8c96b8af2bee7b7eff27de2b2b4ad;hpb=1f4a12c49be0cb8640d60c21f6499c5567646fba;p=lsp-test.git diff --git a/example/Main.hs b/example/Main.hs index 4dd268c..0318ce8 100644 --- a/example/Main.hs +++ b/example/Main.hs @@ -1,16 +1,19 @@ import Language.Haskell.LSP.Test -import qualified Language.Haskell.LSP.TH.DataTypesJSON as LSP -import qualified Data.Text.IO as T -import Control.Lens -import Control.Monad +import Language.Haskell.LSP.Types + import Control.Monad.IO.Class -import System.Directory -import System.Environment -main = do - files <- getArgs - forM_ files $ \fp -> manualSession $ do - file <- liftIO $ canonicalizePath fp - openDocument file - symbols <- documentSymbols file - liftIO $ mapM_ T.putStrLn (symbols ^.. traverse . LSP.name) +main = runSession "hie --lsp" "test/recordings/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 + response <- sendRequest TextDocumentDocumentSymbol params :: Session DocumentSymbolsResponse + liftIO $ print response + + -- Or use one of the helper functions + getDocumentSymbols docItem >>= liftIO . print +