haskell / lsp

Haskell library for the Microsoft Language Server Protocol
360 stars 89 forks source link

Failed to parse message header #461

Closed saitmilk closed 1 year ago

saitmilk commented 1 year ago

vim9 has implemented language server protocol, but the message is like:

'Content-Length: 799\r\nContent-Type: application/vim-jsonrpc; charset=utf-8\r\n\r\n{"method":"initialize","jsonrpc":"2.0","id":1,"params":{"workspaceFolders":[{"uri":"file:///home/s...

and haskell language server comes out:

2022-09-28T19:11:28.497691Z | Info | Starting server  
2022-09-28T19:11:28.499555Z | Error | Failed to parse message header : string

when i send message manually like:

'Content-Length: 799\r\n\r\n{"method":"initialize","jsonrpc":"2.0","id":1,"params":{"workspaceFolders":[{"uri":"file:///home/s...

haskell language server starts successfully:

2022-09-28T19:46:52.562221Z | Info | Starting server  
2022-09-28T19:46:52.566620Z | Info | Started LSP server in 0.01s

according to the specification of language server protocol, header field 'Content-Length' and 'Content-Type' are supported, they are terminated by '\r\n'. Could you please add support for parsing 'Content-Type' header field or just ignore it?

michaelpj commented 1 year ago

Bug here: https://github.com/haskell/lsp/blob/master/lsp/src/Language/LSP/Server/Control.hs#L188

saitmilk commented 1 year ago

yes, no wonder i can't find how it parse message header in haskell-language-server, thank you very much.