{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
module Language.Haskell.LSP.Test.Parsing
( -- $receiving
satisfy
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
module Language.Haskell.LSP.Test.Parsing
( -- $receiving
satisfy
import Language.Haskell.LSP.Types
import qualified Language.Haskell.LSP.Types.Lens as LSP
import Language.Haskell.LSP.Test.Messages
import Language.Haskell.LSP.Types
import qualified Language.Haskell.LSP.Types.Lens as LSP
import Language.Haskell.LSP.Test.Messages
-- | Matches a message of type @a@.
message :: forall a. (Typeable a, FromJSON a) => Session a
message =
let parser = decode . encodeMsg :: FromServerMessage -> Maybe a
-- | Matches a message of type @a@.
message :: forall a. (Typeable a, FromJSON a) => Session a
message =
let parser = decode . encodeMsg :: FromServerMessage -> Maybe a
-responseForId :: forall a. FromJSON a => LspId -> Session (ResponseMessage a)
-responseForId lid = do
- let parser = decode . encodeMsg :: FromServerMessage -> Maybe (ResponseMessage a)
+responseForId :: LspId (m :: Method FromClient Request) -> Session (ResponseMessage m)
+responseForId lid = named (T.pack $ "Response for id: " ++ show lid) $ do
-- | Matches any type of message.
anyMessage :: Session FromServerMessage
anyMessage = satisfy (const True)
-- | Matches any type of message.
anyMessage :: Session FromServerMessage
anyMessage = satisfy (const True)
-- | Matches if the message is a log message notification or a show message notification/request.
loggingNotification :: Session FromServerMessage
-- | Matches if the message is a log message notification or a show message notification/request.
loggingNotification :: Session FromServerMessage
- shouldSkip (NotLogMessage _) = True
- shouldSkip (NotShowMessage _) = True
- shouldSkip (ReqShowMessage _) = True
+ shouldSkip (FromServerMess SWindowLogMessage _) = True
+ shouldSkip (FromServerMess SWindowShowMessage _) = True
+ shouldSkip (FromServerMess SWindowShowMessageRequest _) = True
shouldSkip _ = False
-- | Matches a 'Language.Haskell.LSP.Test.PublishDiagnosticsNotification'
-- (textDocument/publishDiagnostics) notification.
publishDiagnosticsNotification :: Session PublishDiagnosticsNotification
shouldSkip _ = False
-- | Matches a 'Language.Haskell.LSP.Test.PublishDiagnosticsNotification'
-- (textDocument/publishDiagnostics) notification.
publishDiagnosticsNotification :: Session PublishDiagnosticsNotification
-publishDiagnosticsNotification = satisfyMaybe $
- \msg -> case msg of
- NotPublishDiagnostics diags -> Just diags
+publishDiagnosticsNotification = named "Publish diagnostics notification" $
+ satisfyMaybe $ \msg -> case msg of
+ FromServerMess STextDocumentPublishDiagnostics diags -> Just diags