Skip to content

Commit

Permalink
Fix LSP message encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
efoerster committed May 6, 2019
1 parent d821e55 commit 25e7173
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lsp/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ impl Encoder for LspCodec {
type Error = Error;

fn encode(&mut self, item: Self::Item, dst: &mut BytesMut) -> Result<(), Self::Error> {
dst.put(format!("Content-Length: {}\r\n", item.len()));
dst.put("\r\n");
dst.put(item);
let message = format!("Content-Length: {}\r\n\r\n{}", item.len(), item);
trace!("Sent message:\n{}", message);

trace!("Sent message:\n{}", str::from_utf8(&dst.to_vec()).unwrap());
dst.reserve(message.len());
dst.put(message);
Ok(())
}
}
Expand Down

0 comments on commit 25e7173

Please sign in to comment.