# 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
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
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
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
, 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
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
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
-- 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
--
-- @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
-- | 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
-- | 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
--
-- @since 0.11.0.0
getRegisteredCapabilities :: Session [SomeRegistration]
-getRegisteredCapabilities = (Map.elems . curDynCaps) <$> get
+getRegisteredCapabilities = Map.elems . curDynCaps <$> get
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
DidChangeWatchedFilesRegistrationOptions $
List
[ FileSystemWatcher
- (curDir </> "*.watch")
+ (fromString $ curDir </> "*.watch")
(Just (WatchKind True True True))
]
Just token <- runInIO $