From: Luke Lau Date: Sun, 14 Feb 2021 03:15:13 +0000 (+0000) Subject: Merge pull request #87 from bubba/bump-lsp X-Git-Tag: 0.13.0.0 X-Git-Url: https://git.lukelau.me/?p=lsp-test.git;a=commitdiff_plain;h=55ae6885312a90117aab35acdfc470790f30cfca;hp=bc51093aee605aebada2e22d92563c2acb2fbf29 Merge pull request #87 from bubba/bump-lsp Bump lsp commit --- diff --git a/ChangeLog.md b/ChangeLog.md index ee25df7..d82c78d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,15 @@ # Revision history for lsp-test +## 0.13.0.0 -- 2021-02-14 + +* Add support for lsp-types-1.1 (@wz1000) +* Automatically respond to `workspace/applyEdit` and + `window/workDoneProgress/create` messages (@wz1000) + +## 0.12.0.0 -- 2021-01-25 +* Add `getIncompleteProgressSessions` to track ongoing progress sessions + (@wz1000) + ## 0.11.0.0 -- 2020-05-14 * Replace `openDoc'` with `createDoc` which now sends diff --git a/cabal.project b/cabal.project index cc9722a..e125a7d 100644 --- a/cabal.project +++ b/cabal.project @@ -7,10 +7,10 @@ haddock-quickjump: True source-repository-package type: git location: https://github.com/alanz/lsp.git - tag: 96aad3d7cc64fe9e4e29c6bccb19a3ad5ff8926d + tag: b258a6921aeb188b64589f2d12727bbb9e66a93a subdir: lsp-types source-repository-package type: git location: https://github.com/alanz/lsp.git - tag: 96aad3d7cc64fe9e4e29c6bccb19a3ad5ff8926d + tag: b258a6921aeb188b64589f2d12727bbb9e66a93a diff --git a/lsp-test.cabal b/lsp-test.cabal index a0775b3..17ef480 100644 --- a/lsp-test.cabal +++ b/lsp-test.cabal @@ -1,5 +1,5 @@ name: lsp-test -version: 0.11.0.7 +version: 0.13.0.0 synopsis: Functional test framework for LSP servers. description: A test framework for writing tests against @@ -16,7 +16,7 @@ license-file: LICENSE author: Luke Lau maintainer: luke_lau@icloud.com bug-reports: https://github.com/bubba/lsp-test/issues -copyright: 2020 Luke Lau +copyright: 2021 Luke Lau category: Testing build-type: Simple cabal-version: 2.0 @@ -41,7 +41,7 @@ library , parser-combinators:Control.Applicative.Combinators default-language: Haskell2010 build-depends: base >= 4.10 && < 5 - , lsp-types >= 1.0.0.1 && < 1.1 + , lsp-types == 1.1.* , aeson , time , aeson-pretty @@ -82,7 +82,7 @@ executable dummy-server hs-source-dirs: test/dummy-server ghc-options: -W build-depends: base >= 4.11 && < 5 - , lsp >= 1.0.0.1 && < 1.1 + , lsp == 1.1.* , aeson , unordered-containers , directory @@ -102,7 +102,7 @@ test-suite tests build-depends: base >= 4.10 && < 5 , hspec , lens - , lsp-types >= 1.0.0.1 && < 1.1 + , lsp-types == 1.1.* , lsp-test , data-default , aeson diff --git a/src/Language/LSP/Test.hs b/src/Language/LSP/Test.hs index 62b3267..6c5c4a6 100644 --- a/src/Language/LSP/Test.hs +++ b/src/Language/LSP/Test.hs @@ -371,7 +371,7 @@ sendResponse = sendMessage -- The initialize requests and responses are not included the session, -- so if you need to test it use this. initializeResponse :: Session (ResponseMessage Initialize) -initializeResponse = initRsp <$> ask >>= (liftIO . readMVar) +initializeResponse = ask >>= (liftIO . readMVar) . initRsp -- | /Creates/ a new text document. This is different from 'openDoc' -- as it sends a workspace/didChangeWatchedFiles notification letting the server @@ -383,7 +383,7 @@ initializeResponse = initRsp <$> ask >>= (liftIO . readMVar) -- -- @since 11.0.0.0 createDoc :: FilePath -- ^ The path to the document to open, __relative to the root directory__. - -> String -- ^ The text document's language identifier, e.g. @"haskell"@. + -> T.Text -- ^ The text document's language identifier, e.g. @"haskell"@. -> T.Text -- ^ The content of the text document to create. -> Session TextDocumentIdentifier -- ^ The identifier of the document just created. createDoc file languageId contents = do @@ -423,7 +423,7 @@ createDoc file languageId contents = do -- | Opens a text document that /exists on disk/, and sends a -- textDocument/didOpen notification to the server. -openDoc :: FilePath -> String -> Session TextDocumentIdentifier +openDoc :: FilePath -> T.Text -> Session TextDocumentIdentifier openDoc file languageId = do context <- ask let fp = rootDir context file @@ -432,12 +432,12 @@ openDoc file languageId = do -- | This is a variant of `openDoc` that takes the file content as an argument. -- Use this is the file exists /outside/ of the current workspace. -openDoc' :: FilePath -> String -> T.Text -> Session TextDocumentIdentifier +openDoc' :: FilePath -> T.Text -> T.Text -> Session TextDocumentIdentifier openDoc' file languageId contents = do context <- ask let fp = rootDir context file uri = filePathToUri fp - item = TextDocumentItem uri (T.pack languageId) 0 contents + item = TextDocumentItem uri languageId 0 contents sendNotification STextDocumentDidOpen (DidOpenTextDocumentParams item) pure $ TextDocumentIdentifier uri @@ -724,4 +724,4 @@ getCodeLenses tId = do -- -- @since 0.11.0.0 getRegisteredCapabilities :: Session [SomeRegistration] -getRegisteredCapabilities = (Map.elems . curDynCaps) <$> get +getRegisteredCapabilities = Map.elems . curDynCaps <$> get diff --git a/test/dummy-server/Main.hs b/test/dummy-server/Main.hs index aee3449..6beee8b 100644 --- a/test/dummy-server/Main.hs +++ b/test/dummy-server/Main.hs @@ -6,6 +6,7 @@ import Control.Monad.Reader import Data.Aeson hiding (defaultOptions) import qualified Data.HashMap.Strict as HM import Data.List (isSuffixOf) +import Data.String import Language.LSP.Server import Language.LSP.Types import System.Directory @@ -106,7 +107,7 @@ handlers = DidChangeWatchedFilesRegistrationOptions $ List [ FileSystemWatcher - (curDir "*.watch") + (fromString $ curDir "*.watch") (Just (WatchKind True True True)) ] Just token <- runInIO $