Skip to content

Commit

Permalink
Revert "avoid modifying the current directory (haskell#326)"
Browse files Browse the repository at this point in the history
This reverts commit 3e688d9.

This was causing test failures on the ghc9 upgrade
  • Loading branch information
anka-213 committed Jun 5, 2021
1 parent e96383a commit c097d9c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lsp/src/Language/LSP/Server/Processing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ 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 @@ -122,7 +128,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

0 comments on commit c097d9c

Please sign in to comment.