Handle incoming messages with a Content-Length of zero.
While these messages are peculiar, they seem to be allowed by the LSP spec. The current code fails to parse such messages with the following error:
failed to decode message: unable to parse JSON body: EOF while parsing a value at line 1 column 0
This is ultimately emitted by serde_json::from_str which is unable to deserialize the zero-length string as JSON. To resolve this, we add a special case to the decoder which detects zero-length messages and ignores them, skipping forward to decode the next message in the stream.
Fixed
Content-Length
of zero.While these messages are peculiar, they seem to be allowed by the LSP spec. The current code fails to parse such messages with the following error:
This is ultimately emitted by
serde_json::from_str
which is unable to deserialize the zero-length string as JSON. To resolve this, we add a special case to the decoder which detects zero-length messages and ignores them, skipping forward to decode the next message in the stream.Fixes #239.