Skip to content

Commit 770d8f4

Browse files
authored
Raise exception when message is invoked with a CustomMethod (#296)
1 parent 2892969 commit 770d8f4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lsp-test/src/Language/LSP/Test/Parsing.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ named s (Session x) = Session (Data.Conduit.Parser.named s x)
114114

115115

116116
-- | Matches a request or a notification coming from the server.
117+
-- Doesn't match Custom Messages
117118
message :: SServerMethod m -> Session (ServerMessage m)
119+
message (SCustomMethod _) = error "message can't be used with CustomMethod, use customRequest or customNotification instead"
118120
message m1 = named (T.pack $ "Request for: " <> show m1) $ satisfyMaybe $ \case
119121
FromServerMess m2 msg -> do
120122
res <- mEqServer m1 m2
121123
case res of
122124
Right HRefl -> pure msg
123-
Left f -> Nothing
125+
Left _f -> Nothing
124126
_ -> Nothing
125127

126128
customRequest :: T.Text -> Session (ServerMessage (CustomMethod :: Method FromServer Request))

0 commit comments

Comments
 (0)