X-Git-Url: https://git.lukelau.me/?p=lsp-test.git;a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest%2FFiles.hs;h=b56f536a660bb9dd5812b019a381cf6ec5714e3b;hp=1c453a6e2632c83d233358cd57de7d730319db98;hb=ddf9bc17ce8a548a927c201c6b0edb8cf1c9fcad;hpb=1dcc5d9ce4ade0accceafc52c73d66533d343685 diff --git a/src/Language/Haskell/LSP/Test/Files.hs b/src/Language/Haskell/LSP/Test/Files.hs index 1c453a6..b56f536 100644 --- a/src/Language/Haskell/LSP/Test/Files.hs +++ b/src/Language/Haskell/LSP/Test/Files.hs @@ -9,7 +9,7 @@ where import Language.Haskell.LSP.Capture import Language.Haskell.LSP.Types -import Language.Haskell.LSP.Types.Lens hiding (error) +import Language.Haskell.LSP.Types.Lens import Language.Haskell.LSP.Messages import Control.Lens import qualified Data.HashMap.Strict as HM @@ -63,15 +63,11 @@ mapUris f event = fromServerMsg (NotPublishDiagnostics n) = NotPublishDiagnostics $ swapUri params n fromServerMsg (RspDocumentSymbols r) = - let newSymbols = case r ^. result of - Just (DSSymbolInformation si) -> Just (DSSymbolInformation (fmap (swapUri location) si)) - x -> x - in RspDocumentSymbols $ result .~ newSymbols $ r - - fromServerMsg (RspRename r) = - let oldResult = r ^. result :: Maybe WorkspaceEdit - newResult = fmap swapWorkspaceEdit oldResult - in RspRename $ result .~ newResult $ 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) = RspRename $ r & result %~ (fmap swapWorkspaceEdit) fromServerMsg x = x