nixd
|
#include <Connection.h>
Public Member Functions | |
llvm::Expected< llvm::json::Value > | readStandardMessage (std::string &Buffer) |
llvm::Expected< llvm::json::Value > | readLitTestMessage (std::string &Buffer) |
Read one message, expecting the input to be one of our Markdown lit-tests. | |
void | close () |
Notify the inbound port to close the connection. | |
InboundPort (int In=STDIN_FILENO, JSONStreamStyle StreamStyle=JSONStreamStyle::Standard) | |
llvm::Expected< llvm::json::Value > | readMessage (std::string &Buffer) |
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 54 of file Connection.h.
References In, lspserver::Standard, and StreamStyle.
|
inline |
Notify the inbound port to close the connection.
Definition at line 52 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 126 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 318 of file Connection.cpp.
References dispatch(), lspserver::elog(), readMessage(), and lspserver::vlog().
llvm::Expected< llvm::json::Value > lspserver::InboundPort::readLitTestMessage | ( | std::string & | Buffer | ) |
Read one message, expecting the input to be one of our Markdown lit-tests.
Definition at line 246 of file Connection.cpp.
References In, and lspserver::readLine().
Referenced by readMessage().
llvm::Expected< llvm::json::Value > lspserver::InboundPort::readMessage | ( | std::string & | Buffer | ) |
Read one LSP message depending on the configured StreamStyle. The parsed value is returned. The given Buffer
is only used internally.
Definition at line 306 of file Connection.cpp.
References lspserver::LitTest, readLitTestMessage(), readStandardMessage(), lspserver::Standard, and StreamStyle.
Referenced by loop().
llvm::Expected< llvm::json::Value > lspserver::InboundPort::readStandardMessage | ( | std::string & | Buffer | ) |
Read one message as specified in the LSP standard. 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 210 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 InboundPort(), readLitTestMessage(), and readStandardMessage().
JSONStreamStyle lspserver::InboundPort::StreamStyle = JSONStreamStyle::Standard |
Definition at line 41 of file Connection.h.
Referenced by InboundPort(), and readMessage().