packages feed

lsp-test 0.5.3.0 → 0.5.4.0

raw patch · 3 files changed

+20/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Language.Haskell.LSP.Test: getCodeLenses :: TextDocumentIdentifier -> Session [CodeLens]

Files

ChangeLog.md view
@@ -1,12 +1,15 @@ # Revision history for lsp-test +## 0.5.4.0 -- 2019-06-13++* Fix `getDefinitions` for SingleLoc (@cocreature)+* Add `getCodeLenses` (@cocreature)+ ## 0.5.3.0 -- 2019-06-13  * Update to haskell-lsp-0.14.0.0 (@cocreature) * Support `TextDocumentDidChange` (@cocreature) * Add non-file based `openDoc` (@cocreature)-* Fix `getDefinitions` for `SingleLoc` (@cocreature)-* Add `getCodeLenses` (@cocreature)  ## 0.5.2.0 -- 2019-04-28 
lsp-test.cabal view
@@ -1,5 +1,5 @@ name:                lsp-test-version:             0.5.3.0+version:             0.5.4.0 synopsis:            Functional test framework for LSP servers. description:   A test framework for writing tests against
src/Language/Haskell/LSP/Test.hs view
@@ -79,6 +79,8 @@   , formatRange   -- ** Edits   , applyEdit+  -- ** Code lenses+  , getCodeLenses   ) where  import Control.Applicative.Combinators@@ -518,9 +520,12 @@ getDefinitions :: TextDocumentIdentifier -- ^ The document the term is in.                -> Position -- ^ The position the term is at.                -> Session [Location] -- ^ The location(s) of the definitions-getDefinitions doc pos =+getDefinitions doc pos = do   let params = TextDocumentPositionParams doc pos-  in getResponseResult <$> request TextDocumentDefinition params+  rsp <- request TextDocumentDefinition params :: Session DefinitionResponse+  case getResponseResult rsp of+      SingleLoc loc -> pure [loc]+      MultiLoc locs -> pure locs  -- | Returns the type definition(s) for the term at the specified position. getTypeDefinitions :: TextDocumentIdentifier -- ^ The document the term is in.@@ -577,3 +582,10 @@   let wEdit = WorkspaceEdit (Just (HashMap.singleton (doc ^. uri) edits)) Nothing       req = RequestMessage "" (IdInt 0) WorkspaceApplyEdit (ApplyWorkspaceEditParams wEdit)   in updateState (ReqApplyWorkspaceEdit req)++-- | Returns the code lenses for the specified document.+getCodeLenses :: TextDocumentIdentifier -> Session [CodeLens]+getCodeLenses tId = do+    rsp <- request TextDocumentCodeLens (CodeLensParams tId) :: Session CodeLensResponse+    case getResponseResult rsp of+        List res -> pure res