@@ -25,6 +25,7 @@ module Language.LSP.Test
25
25
Session
26
26
, runSession
27
27
, runSessionWithConfig
28
+ , runSessionWithConfigCustomProcess
28
29
, runSessionWithHandles
29
30
, runSessionWithHandles'
30
31
-- ** Config
@@ -133,7 +134,7 @@ import System.Environment
133
134
import System.IO
134
135
import System.Directory
135
136
import System.FilePath
136
- import System.Process (ProcessHandle )
137
+ import System.Process (ProcessHandle , CreateProcess )
137
138
import qualified System.FilePath.Glob as Glob
138
139
import Control.Monad.State (execState )
139
140
@@ -159,9 +160,19 @@ runSessionWithConfig :: SessionConfig -- ^ Configuration options for the session
159
160
-> FilePath -- ^ The filepath to the root directory for the session.
160
161
-> Session a -- ^ The session to run.
161
162
-> IO a
162
- runSessionWithConfig config' serverExe caps rootDir session = do
163
+ runSessionWithConfig = runSessionWithConfigCustomProcess id
164
+
165
+ -- | Starts a new session with a custom configuration and server 'CreateProcess'.
166
+ runSessionWithConfigCustomProcess :: (CreateProcess -> CreateProcess ) -- ^ Tweak the 'CreateProcess' used to start the server.
167
+ -> SessionConfig -- ^ Configuration options for the session.
168
+ -> String -- ^ The command to run the server.
169
+ -> C. ClientCapabilities -- ^ The capabilities that the client should declare.
170
+ -> FilePath -- ^ The filepath to the root directory for the session.
171
+ -> Session a -- ^ The session to run.
172
+ -> IO a
173
+ runSessionWithConfigCustomProcess modifyCreateProcess config' serverExe caps rootDir session = do
163
174
config <- envOverrideConfig config'
164
- withServer serverExe (logStdErr config) $ \ serverIn serverOut serverProc ->
175
+ withServer serverExe (logStdErr config) modifyCreateProcess $ \ serverIn serverOut serverProc ->
165
176
runSessionWithHandles' (Just serverProc) serverIn serverOut config caps rootDir session
166
177
167
178
-- | Starts a new session, using the specified handles to communicate with the
@@ -770,7 +781,7 @@ getSemanticTokens :: TextDocumentIdentifier -> Session (Maybe SemanticTokens)
770
781
getSemanticTokens doc = do
771
782
let params = SemanticTokensParams Nothing Nothing doc
772
783
rsp <- request STextDocumentSemanticTokensFull params
773
- pure $ getResponseResult rsp
784
+ pure $ getResponseResult rsp
774
785
775
786
-- | Returns a list of capabilities that the server has requested to /dynamically/
776
787
-- register during the 'Session'.
0 commit comments