Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Commit

Permalink
Avoid error when trying to shutdown manual js session
Browse files Browse the repository at this point in the history
  • Loading branch information
jneira committed Jul 11, 2019
1 parent a75d911 commit 6f031f5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Language/Haskell/LSP/Test/Decoding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ getRequestMap = foldl helper HM.empty
matchResponseMsgType :: ClientMethod -> B.ByteString -> FromServerMessage
matchResponseMsgType req = case req of
Initialize -> RspInitialize . decoded
Shutdown -> RspShutdown . decoded
Shutdown -> RspShutdown . decoded . removeNullResult
TextDocumentHover -> RspHover . decoded
TextDocumentCompletion -> RspCompletion . decoded
CompletionItemResolve -> RspCompletionItemResolve . decoded
Expand All @@ -120,6 +120,7 @@ matchResponseMsgType req = case req of
where decoded x = fromMaybe (error $ "Couldn't decode response for the request type: "
++ show req ++ "\n" ++ show x)
(decode x)
removeNullResult x = maybe x (<> "}") (B.stripSuffix ",\"result\":null}" x)

decodeFromServerMsg :: RequestMap -> B.ByteString -> FromServerMessage
decodeFromServerMsg reqMap bytes =
Expand Down

0 comments on commit 6f031f5

Please sign in to comment.