packages feed

lsp-test 0.11.0.7 → 0.12.0.0

raw patch · 4 files changed

+19/−3 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Language.Haskell.LSP.Test: getIncompleteProgressSessions :: Session (Set ProgressToken)

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for lsp-test +## 0.12.0.0 -- 2021-01-25++* Add `getIncompleteProgressSessions` to track in ongoing progress sessions (@wz1000)+ ## 0.11.0.0 -- 2020-05-14  * Replace `openDoc'` with `createDoc` which now sends
lsp-test.cabal view
@@ -1,5 +1,5 @@ name:                lsp-test-version:             0.11.0.7+version:             0.12.0.0 synopsis:            Functional test framework for LSP servers. description:   A test framework for writing tests against@@ -16,7 +16,7 @@ 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
src/Language/Haskell/LSP/Test.hs view
@@ -56,6 +56,7 @@   , waitForDiagnosticsSource   , noDiagnostics   , getCurrentDiagnostics+  , getIncompleteProgressSessions   -- ** Commands   , executeCommand   -- ** Code Actions@@ -93,6 +94,7 @@ import Control.Exception import Control.Lens hiding ((.=), List) import qualified Data.Map.Strict as Map+import qualified Data.Set as Set import qualified Data.Text as T import qualified Data.Text.IO as T import Data.Aeson@@ -516,6 +518,10 @@ -- Note that this does not wait for more to come in. getCurrentDiagnostics :: TextDocumentIdentifier -> Session [Diagnostic] getCurrentDiagnostics doc = fromMaybe [] . Map.lookup (toNormalizedUri $ doc ^. uri) . curDiagnostics <$> get++-- | Returns the tokens of all progress sessions that have started but not yet ended.+getIncompleteProgressSessions :: Session (Set.Set ProgressToken)+getIncompleteProgressSessions = curProgressSessions <$> get  -- | Executes a command. executeCommand :: Command -> Session ()
src/Language/Haskell/LSP/Test/Session.hs view
@@ -54,6 +54,7 @@ import Data.Foldable import Data.List import qualified Data.Map as Map+import qualified Data.Set as Set import qualified Data.Text as T import qualified Data.Text.IO as T import qualified Data.HashMap.Strict as HashMap@@ -170,6 +171,7 @@   , curDynCaps :: Map.Map T.Text Registration   -- ^ The capabilities that the server has dynamically registered with us so   -- far+  , curProgressSessions :: Set.Set ProgressToken   }  class Monad m => HasState s m where@@ -260,7 +262,7 @@   mainThreadId <- myThreadId    let context = SessionContext serverIn absRootDir messageChan timeoutIdVar reqMap initRsp config caps-      initState vfs = SessionState (IdInt 0) vfs mempty False Nothing mempty+      initState vfs = SessionState (IdInt 0) vfs mempty False Nothing mempty mempty       runSession' ses = initVFS $ \vfs -> runSession context (initState vfs) ses        errorHandler = throwTo mainThreadId :: SessionException -> IO ()@@ -292,6 +294,10 @@  updateState :: (MonadIO m, HasReader SessionContext m, HasState SessionState m)             => FromServerMessage -> m ()+updateState (NotWorkDoneProgressBegin req) =+  modify $ \s -> s { curProgressSessions = Set.insert (req ^. params . token) $ curProgressSessions s }+updateState (NotWorkDoneProgressEnd req) =+  modify $ \s -> s { curProgressSessions = Set.delete (req ^. params . token) $ curProgressSessions s }  -- Keep track of dynamic capability registration updateState (ReqRegisterCapability req) = do