Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed May 19, 2024
1 parent 3a5c2cf commit bb45003
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ghcide/src/Development/IDE/LSP/LanguageServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ setupLSP ::
-> IO (LSP.LanguageContextEnv config -> TRequestMessage Method_Initialize -> IO (Either err (LSP.LanguageContextEnv config, IdeState)),
LSP.Handlers (ServerM config),
(LanguageContextEnv config, IdeState) -> ServerM config <~> IO)
setupLSP recorder root getHieDbLoc userHandlers getIdeState clientMsgVar = do
setupLSP recorder defaultRoot getHieDbLoc userHandlers getIdeState clientMsgVar = do
-- Send everything over a channel, since you need to wait until after initialise before
-- LspFuncs is available
clientMsgChan :: Chan ReactorMessage <- newChan
Expand Down Expand Up @@ -177,7 +177,7 @@ setupLSP recorder root getHieDbLoc userHandlers getIdeState clientMsgVar = do
-- Cancel requests are special since they need to be handled
-- out of order to be useful. Existing handlers are run afterwards.

let doInitialize = handleInit recorder root getHieDbLoc getIdeState reactorLifetime exit clearReqId waitForCancel clientMsgChan
let doInitialize = handleInit recorder defaultRoot getHieDbLoc getIdeState reactorLifetime exit clearReqId waitForCancel clientMsgChan

let interpretHandler (env, st) = LSP.Iso (LSP.runLspT env . flip (runReaderT . unServerM) (clientMsgChan,st)) liftIO

Expand All @@ -195,13 +195,13 @@ handleInit
-> (SomeLspId -> IO ())
-> Chan ReactorMessage
-> LSP.LanguageContextEnv config -> TRequestMessage Method_Initialize -> IO (Either err (LSP.LanguageContextEnv config, IdeState))
handleInit recorder rootDir getHieDbLoc getIdeState lifetime exitClientMsg clearReqId waitForCancel clientMsgChan env (TRequestMessage _ _ m params) = otTracedHandler "Initialize" (show m) $ \sp -> do
handleInit recorder defaultRoot getHieDbLoc getIdeState lifetime exitClientMsg clearReqId waitForCancel clientMsgChan env (TRequestMessage _ _ m params) = otTracedHandler "Initialize" (show m) $ \sp -> do
traceWithSpan sp params
let rootMaybe = LSP.resRootPath env
-- only shift if lsp root is different from the rootDir
when (rootMaybe /= Just rootDir) $ do
setCurrentDirectory rootDir
let root = fromMaybe rootDir rootMaybe
root <- case rootMaybe of
Just lspRoot | lspRoot /= defaultRoot -> setCurrentDirectory lspRoot >> return lspRoot
_ -> pure defaultRoot
dbLoc <- getHieDbLoc root
let initConfig = parseConfiguration params
logWith recorder Info $ LogRegisteringIdeConfig initConfig
Expand Down

0 comments on commit bb45003

Please sign in to comment.