eclipse-lsp4j/lsp4j

The problem of org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer

Closed this issue · 5 comments

About the fireError method of the org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer class frequently reports an error Missing header Content-Length in input "
"
Java.lang.IllegalStateException: Missing header Content-Length in input "
"but it has no effect in use. Why not show this error?"

Can you provide additional information about how to reproduce this please? Or a sample trace that produces the issue you are experiencing.

Sorry, the machine translation may not translate what I want to express, I mean in line 72 of org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer "if (headers.contentLength < 0) {.
This.fireError (new IllegalStateException ("Missing header Content-Length in input"+ debugBuilder +"\ ")).
} else {.
Boolean result = this.handleMessage (this.input, headers).
If (! result) {.
This.keepRunning = false.
}.

NewLine = false.
The this.fireError method called in "}" prints an error log (because the server did not send a complete message), and the error is displayed in intellij, but I do not want to show this error

That error happens when the server sends an incomplete message, as you have concluded. But I don't know what change you want LSP4J to make. The error is logged, but if it is displayed in a way you don't like in intellij, should that be filled to intellij?

If I recall correctly you can extend and wire in your own subclass of StreamMessageProducer and in that subclass override fireError to have different behaviour.

Thank you for reminding me that the project is too bloated and has forgotten how to write it before. I'm sorry I wasted your time.

I assume the machine translation wrote that last message as I don't think it came across as you may have intended.

Closing for now as it seems there is nothing else for the LSP4J project to do here.