X-Git-Url: https://git.lukelau.me/?a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest%2FFiles.hs;h=b56f536a660bb9dd5812b019a381cf6ec5714e3b;hb=ddf9bc17ce8a548a927c201c6b0edb8cf1c9fcad;hp=733a94c160ea94634ef34fc0230ca6f65f4bfe80;hpb=1519d72b72435e798b02bb698eccab8f9683dec1;p=lsp-test.git diff --git a/src/Language/Haskell/LSP/Test/Files.hs b/src/Language/Haskell/LSP/Test/Files.hs index 733a94c..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 @@ -62,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