Skip to content

Need to clarify when to sendData:toClient: #17

@NicolasAnquetil

Description

@NicolasAnquetil

In PLSAbstractServer >> handleRequest:toClient:
the server treats a request from the client and answers it:

  • jrpcMessage := self parseJSON: request
  • self sendData: (self handleJSON: jrpcMessage) toClient: clientSocket.

For example, <jrpc: #initialize> (first request from client) returns ^ PLSInitializeResult new that is send back to the client by handleRequest:toClient:

But several jrpc handlers also directly call sendData:toClient:

  • <jrpc: #'textDocument/didOpen'>
didOpen: textDocument
...
	self sendData: (self convertJRPCJsonableObjectToJSON:
			((JRPCNotificationObject method:
...
				asJRPCJSON)
		toClient: clientOutStream
  • <jrpc: #'textDocument/didClose'>
  • <jrpc: #'textDocument/didChange'>
    (This case is worse because it may also call didOpen:)
  • etc

(they seem to be mostly the ones in the lsp - text synchronisation protocol.

Note that handleJSON: also uses convertJRPCJsonableObjectToJSON: ... asJRPCJSON that we see in the "duplicated" sendData:toClient: calls.

Would be nice to have a clearer definition of who is responsible for sending the answer.
My guess is the handlers should avoid to do it ... ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions