X-Git-Url: http://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest.hs;h=7f13a59e111a4e93e63d60198b165a43388bd1db;hp=047e35b0ac715d765eeb4f1c02f11a63b015426e;hb=5d58e92cc411d9f89f55737b6a225075e77f4f6b;hpb=312e6e45078d7bdf759d8f1b222557734c1a9dd0 diff --git a/src/Language/Haskell/LSP/Test.hs b/src/Language/Haskell/LSP/Test.hs index 047e35b..7f13a59 100644 --- a/src/Language/Haskell/LSP/Test.hs +++ b/src/Language/Haskell/LSP/Test.hs @@ -16,6 +16,7 @@ module Language.Haskell.LSP.Test -- * Sessions runSession , runSessionWithHandles + , runSessionWithCapabilities , Session -- * Sending , sendRequest @@ -76,6 +77,7 @@ import qualified Data.HashMap.Strict as HashMap import Data.List import Language.Haskell.LSP.Types import qualified Language.Haskell.LSP.Types as LSP (error, id) +import Language.Haskell.LSP.TH.ClientCapabilities import Language.Haskell.LSP.Messages import Language.Haskell.LSP.VFS import Language.Haskell.LSP.Test.Compat @@ -92,7 +94,15 @@ runSession :: String -- ^ The command to run the server. -> FilePath -- ^ The filepath to the root directory for the session. -> Session a -- ^ The session to run. -> IO a -runSession serverExe rootDir session = do +runSession = runSessionWithCapabilities def + +-- | Starts a new sesion with a client with the specified capabilities. +runSessionWithCapabilities :: ClientCapabilities -- ^ The capabilities the client should have. + -> String -- ^ The command to run the server. + -> FilePath -- ^ The filepath to the root directory for the session. + -> Session a -- ^ The session to run. + -> IO a +runSessionWithCapabilities caps serverExe rootDir session = do pid <- getProcessID absRootDir <- canonicalizePath rootDir @@ -100,7 +110,7 @@ runSession serverExe rootDir session = do (Just $ T.pack absRootDir) (Just $ filePathToUri absRootDir) Nothing - def + caps (Just TraceOff) withServer serverExe $ \serverIn serverOut _ -> runSessionWithHandles serverIn serverOut listenServer rootDir $ do