-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Motivation
The language server currently uses HTTP communication to communicate between the python executable and the gall app. This is undesirable for a number of reasons, chief amongst these being the need to shoehorn bidirectional JSON-RPC semantics into a traditional HTTP request response model.
Example
textDocument/publishDiagnostics is currently updated upon save and upon a completion request. I don't think we should throw the holy water here and just bless random methods that trigger a parse. However, if we don't do this, we have no open HTTP req to send back our diagnostics upon.
textDocument/didSave blocks upon saving and this becomes an issue with larger files which has to parse the whole file before sending back a response.
Solution
The channel interface from eyre, which implements remote subscribe and poke functionality, could be used to supplement the current HTTP interface for language server. Some methods should be moved over to the channel interface and others fit comfortably into the current request/response semantics.
Example
textDocument/didChange would be implemented with a poke, as it does not need to return a value.
textDocument/publishDiagnostics would be implemented with a subscription, allowing for much finer grained control of when diagnostics are calculated and sent. e.g. debouncing updates to trigger a reparse and updating when we receive a %made sign
Due to python's weird async support (read: I don't understand it) and the fact that event-stream and channels are somewhat JS specific interfaces I'm considering rewriting the python proxy in node, if this proposal goes ahead.
cc: @philipcmonk