packages feed

lsp-test 0.1.0.0 → 0.2.0.0

raw patch · 6 files changed

+25/−17 lines, 6 filesdep ~haskell-lspPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: haskell-lsp

API changes (from Hackage documentation)

- Language.Haskell.LSP.Test: getAllCodeActions :: TextDocumentIdentifier -> Session [CommandOrCodeAction]
+ Language.Haskell.LSP.Test: getAllCodeActions :: TextDocumentIdentifier -> Session [CAResult]
- Language.Haskell.LSP.Test: getDocumentSymbols :: TextDocumentIdentifier -> Session [SymbolInformation]
+ Language.Haskell.LSP.Test: getDocumentSymbols :: TextDocumentIdentifier -> Session (Either [DocumentSymbol] [SymbolInformation])

Files

+ ChangeLog.md view
@@ -0,0 +1,5 @@+# Revision history for lsp-test++## 0.2.0.0 -- 2018-08-06++* Update to haskell-lsp 0.6.0.0
README.md view
@@ -1,4 +1,4 @@-# lsp-test [![Build Status](https://travis-ci.com/Bubba/haskell-lsp-test.svg?branch=master)](https://travis-ci.com/Bubba/haskell-lsp-test)+# lsp-test [![Build Status](https://travis-ci.com/Bubba/haskell-lsp-test.svg?branch=master)](https://travis-ci.com/Bubba/haskell-lsp-test) [![Hackage](https://img.shields.io/hackage/v/lsp-test.svg)](https://hackage.haskell.org/package/lsp-test-0.1.0.0) lsp-test is a functional testing framework for Language Server Protocol servers.  ```haskell
lsp-test.cabal view
@@ -1,5 +1,5 @@ name:                lsp-test-version:             0.1.0.0+version:             0.2.0.0 synopsis:            Functional test framework for LSP servers. description:   A test framework for writing tests against @@ -20,6 +20,7 @@ build-type:          Simple cabal-version:       2.0 extra-source-files:  README.md+                   , ChangeLog.md tested-with:         GHC == 8.2.2 , GHC == 8.4.2 , GHC == 8.4.3  source-repository head@@ -35,7 +36,7 @@                      , parser-combinators:Control.Applicative.Combinators   default-language:    Haskell2010   build-depends:       base >= 4.7 && < 5-                     , haskell-lsp >= 0.5+                     , haskell-lsp >= 0.6                      , aeson                      , aeson-pretty                      , ansi-terminal@@ -78,7 +79,7 @@                      , hspec                      , lens                      , data-default-                     , haskell-lsp >= 0.5+                     , haskell-lsp >= 0.6                      , lsp-test                      , aeson                      , unordered-containers
src/Language/Haskell/LSP/Test.hs view
@@ -349,17 +349,19 @@   when (diagsNot ^. params . LSP.diagnostics /= List []) $ liftIO $ throw UnexpectedDiagnostics  -- | Returns the symbols in a document.-getDocumentSymbols :: TextDocumentIdentifier -> Session [SymbolInformation]+getDocumentSymbols :: TextDocumentIdentifier -> Session (Either [DocumentSymbol] [SymbolInformation]) getDocumentSymbols doc = do-  ResponseMessage _ rspLid mRes mErr <- request TextDocumentDocumentSymbol (DocumentSymbolParams doc)+  ResponseMessage _ rspLid mRes mErr <- request TextDocumentDocumentSymbol (DocumentSymbolParams doc) :: Session DocumentSymbolsResponse   maybe (return ()) (throw . UnexpectedResponseError rspLid) mErr-  let (Just (List symbols)) = mRes-  return symbols+  case mRes of+    Just (DSDocumentSymbols (List xs)) -> return (Left xs)+    Just (DSSymbolInformation (List xs)) -> return (Right xs)+    Nothing -> Prelude.error "No result and no error in DocumentSymbolsResponse"  -- | Returns all the code actions in a document by  -- querying the code actions at each of the current  -- diagnostics' positions.-getAllCodeActions :: TextDocumentIdentifier -> Session [CommandOrCodeAction]+getAllCodeActions :: TextDocumentIdentifier -> Session [CAResult] getAllCodeActions doc = do   curDiags <- fromMaybe [] . Map.lookup (doc ^. uri) . curDiagnostics <$> get   let ctx = CodeActionContext (List curDiags) Nothing@@ -367,7 +369,7 @@   foldM (go ctx) [] curDiags    where-    go :: CodeActionContext -> [CommandOrCodeAction] -> Diagnostic -> Session [CommandOrCodeAction]+    go :: CodeActionContext -> [CAResult] -> Diagnostic -> Session [CAResult]     go ctx acc diag = do       ResponseMessage _ rspLid mRes mErr <- request TextDocumentCodeAction (CodeActionParams doc (diag ^. range) ctx) 
src/Language/Haskell/LSP/Test/Files.hs view
@@ -62,7 +62,9 @@     fromServerMsg (NotPublishDiagnostics n) = NotPublishDiagnostics $ swapUri params n      fromServerMsg (RspDocumentSymbols r) =-      let newSymbols = fmap (fmap (swapUri location)) $ r ^. result+      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) =
test/Test.hs view
@@ -18,7 +18,6 @@ import           Language.Haskell.LSP.Messages import           Language.Haskell.LSP.Test import           Language.Haskell.LSP.Test.Replay-import           Language.Haskell.LSP.Types.Capabilities import           Language.Haskell.LSP.Types as LSP hiding (capabilities, message) import           System.Timeout @@ -134,7 +133,7 @@          noDiagnostics -        (fooSymbol:_) <- getDocumentSymbols doc+        Right (fooSymbol:_) <- getDocumentSymbols doc          liftIO $ do           fooSymbol ^. name `shouldBe` "foo"@@ -183,7 +182,7 @@       _ <- waitForDiagnostics       actions <- getAllCodeActions doc       liftIO $ do-        let [CommandOrCodeActionCodeAction action] = actions+        let [CACodeAction action] = actions         action ^. title `shouldBe` "Apply hint:Redundant bracket"         action ^. command . _Just . command `shouldSatisfy` T.isSuffixOf ":applyrefact:applyOne" @@ -195,13 +194,12 @@        noDiagnostics -      (mainSymbol:_) <- getDocumentSymbols doc+      Left (mainSymbol:_) <- getDocumentSymbols doc        liftIO $ do         mainSymbol ^. name `shouldBe` "main"         mainSymbol ^. kind `shouldBe` SkFunction-        mainSymbol ^. location . range `shouldBe` Range (Position 3 0) (Position 3 4)-        mainSymbol ^. containerName `shouldBe` Nothing+        mainSymbol ^. range `shouldBe` Range (Position 3 0) (Position 3 4)    describe "applyEdit" $ do     it "increments the version" $ runSession "hie --lsp" docChangesCaps "test/data/renamePass" $ do