Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid modifying the current directory #326

Merged
merged 1 commit into from
Apr 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions lsp/src/Language/LSP/Server/Processing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ initializeRequestHandler ServerDefinition{..} vfs sendFunc req = do
rootDir = getFirst $ foldMap First [ params ^. LSP.rootUri >>= uriToFilePath
, params ^. LSP.rootPath <&> T.unpack ]

liftIO $ case rootDir of
Nothing -> return ()
Just dir -> do
debugM "lsp.initializeRequestHandler" $ "Setting current dir to project root:" ++ dir
unless (null dir) $ setCurrentDirectory dir

let initialWfs = case params ^. LSP.workspaceFolders of
Just (List xs) -> xs
Nothing -> []
Expand Down Expand Up @@ -128,7 +122,7 @@ initializeRequestHandler ServerDefinition{..} vfs sendFunc req = do
where
makeResponseMessage rid result = ResponseMessage "2.0" (Just rid) (Right result)
makeResponseError origId err = ResponseMessage "2.0" (Just origId) (Left err)

initializeErrorHandler :: (ResponseError -> IO ()) -> E.SomeException -> IO (Maybe a)
initializeErrorHandler sendResp e = do
sendResp $ ResponseError InternalError msg Nothing
Expand Down