X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest%2FFiles.hs;h=b56f536a660bb9dd5812b019a381cf6ec5714e3b;hb=ddf9bc17ce8a548a927c201c6b0edb8cf1c9fcad;hp=f82df65cf6cef89640538575cffb69923c32934e;hpb=13928a9c66b4a352ae784660877d4fae57ac81d9;p=lsp-test.git diff --git a/src/Language/Haskell/LSP/Test/Files.hs b/src/Language/Haskell/LSP/Test/Files.hs index f82df65..b56f536 100644 --- a/src/Language/Haskell/LSP/Test/Files.hs +++ b/src/Language/Haskell/LSP/Test/Files.hs @@ -8,7 +8,8 @@ module Language.Haskell.LSP.Test.Files where import Language.Haskell.LSP.Capture -import Language.Haskell.LSP.Types hiding ( error ) +import Language.Haskell.LSP.Types +import Language.Haskell.LSP.Types.Lens import Language.Haskell.LSP.Messages import Control.Lens import qualified Data.HashMap.Strict as HM @@ -50,7 +51,7 @@ mapUris f event = fromClientMsg (NotWillSaveTextDocument n) = NotWillSaveTextDocument $ swapUri (params . textDocument) n fromClientMsg (NotDidSaveTextDocument n) = NotDidSaveTextDocument $ swapUri (params . textDocument) n fromClientMsg (NotDidCloseTextDocument n) = NotDidCloseTextDocument $ swapUri (params . textDocument) n - fromClientMsg (ReqInitialize r) = ReqInitialize $ params .~ (transformInit (r ^. params)) $ r + fromClientMsg (ReqInitialize r) = ReqInitialize $ params .~ transformInit (r ^. params) $ r fromClientMsg (ReqDocumentSymbols r) = ReqDocumentSymbols $ swapUri (params . textDocument) r fromClientMsg (ReqRename r) = ReqRename $ swapUri (params . textDocument) r fromClientMsg x = x @@ -62,13 +63,11 @@ mapUris f event = fromServerMsg (NotPublishDiagnostics n) = NotPublishDiagnostics $ swapUri params n fromServerMsg (RspDocumentSymbols r) = - let newSymbols = fmap (fmap (swapUri location)) $ r ^. result - in RspDocumentSymbols $ result .~ newSymbols $ r + let swapUri' (DSSymbolInformation si) = DSSymbolInformation (swapUri location <$> si) + swapUri' (DSDocumentSymbols dss) = DSDocumentSymbols dss -- no file locations here + in RspDocumentSymbols $ r & result %~ (fmap swapUri') - fromServerMsg (RspRename r) = - let oldResult = r ^. result :: Maybe WorkspaceEdit - newResult = fmap swapWorkspaceEdit oldResult - in RspRename $ result .~ newResult $ r + fromServerMsg (RspRename r) = RspRename $ r & result %~ (fmap swapWorkspaceEdit) fromServerMsg x = x