nixd
|
#include <Connection.h>
Public Member Functions | |
bool | readStandardMessage (std::string &JSONString) |
bool | readDelimitedMessage (std::string &JSONString) |
void | close () |
Notify the inbound port to close the connection. | |
InboundPort (int In=STDIN_FILENO, JSONStreamStyle StreamStyle=JSONStreamStyle::Standard) | |
bool | readMessage (std::string &JSONString) |
bool | dispatch (llvm::json::Value Message, MessageHandler &Handler) |
void | loop (MessageHandler &Handler) |
Public Attributes | |
int | In |
JSONStreamStyle | StreamStyle = JSONStreamStyle::Standard |
Definition at line 34 of file Connection.h.
|
inline |
Definition at line 50 of file Connection.h.
|
inline |
Notify the inbound port to close the connection.
Definition at line 48 of file Connection.h.
bool lspserver::InboundPort::dispatch | ( | llvm::json::Value | Message, |
MessageHandler & | Handler ) |
Dispatch messages to on{Notify,Call,Reply} ( Handlers
) Return values should be forwarded from Handlers
i.e. returns true to keep processing messages, or false to shut down.
Definition at line 104 of file Connection.cpp.
References lspserver::decodeError(), lspserver::elog(), lspserver::Method, lspserver::Object, lspserver::MessageHandler::onCall(), lspserver::MessageHandler::onNotify(), and lspserver::MessageHandler::onReply().
Referenced by loop().
void lspserver::InboundPort::loop | ( | MessageHandler & | Handler | ) |
Definition at line 261 of file Connection.cpp.
References dispatch(), lspserver::elog(), readMessage(), and lspserver::vlog().
bool lspserver::InboundPort::readDelimitedMessage | ( | std::string & | JSONString | ) |
Definition at line 222 of file Connection.cpp.
References In, and lspserver::readLine().
Referenced by readMessage().
bool lspserver::InboundPort::readMessage | ( | std::string & | JSONString | ) |
Read messages specified in LSP standard, and collect standard json string into JSONString
. A Language Server Protocol message starts with a set of HTTP headers, delimited by \r
, and terminated by an empty line (\r
).
Definition at line 248 of file Connection.cpp.
References lspserver::Delimited, readDelimitedMessage(), readStandardMessage(), lspserver::Standard, and StreamStyle.
Referenced by loop().
bool lspserver::InboundPort::readStandardMessage | ( | std::string & | JSONString | ) |
Definition at line 187 of file Connection.cpp.
References lspserver::elog(), In, lspserver::Read, and lspserver::readLine().
Referenced by readMessage().
int lspserver::InboundPort::In |
Definition at line 39 of file Connection.h.
Referenced by readDelimitedMessage(), and readStandardMessage().
JSONStreamStyle lspserver::InboundPort::StreamStyle = JSONStreamStyle::Standard |
Definition at line 41 of file Connection.h.
Referenced by readMessage().