LLVM 22.0.0git
|
A handler used to process the incoming transport messages. More...
#include "llvm/Support/LSP/Transport.h"
Public Member Functions | |
MessageHandler (JSONTransport &Transport) | |
bool | onNotify (StringRef Method, llvm::json::Value Value) |
bool | onCall (StringRef Method, llvm::json::Value Params, llvm::json::Value Id) |
bool | onReply (llvm::json::Value Id, llvm::Expected< llvm::json::Value > Result) |
template<typename Param, typename Result, typename ThisT> | |
void | method (llvm::StringLiteral Method, ThisT *ThisPtr, void(ThisT::*Handler)(const Param &, Callback< Result >)) |
template<typename Param, typename ThisT> | |
void | notification (llvm::StringLiteral Method, ThisT *ThisPtr, void(ThisT::*Handler)(const Param &)) |
template<typename T> | |
OutgoingNotification< T > | outgoingNotification (llvm::StringLiteral Method) |
Create an OutgoingNotification object used for the given method. | |
template<typename Param, typename Result> | |
OutgoingRequest< Param > | outgoingRequest (llvm::StringLiteral Method, OutgoingRequestCallback< Result > Callback) |
Create an OutgoingRequest function that, when called, sends a request with the given method via the transport. |
Static Public Member Functions | |
template<typename T> | |
static llvm::Expected< T > | parse (const llvm::json::Value &Raw, StringRef PayloadName, StringRef PayloadKind) |
A handler used to process the incoming transport messages.
Definition at line 157 of file Transport.h.
|
inline |
Definition at line 159 of file Transport.h.
|
inline |
Definition at line 186 of file Transport.h.
References llvm::lsp::Method, llvm::lsp::Parameter, and parse().
|
inline |
Definition at line 200 of file Transport.h.
References llvm::consumeError(), llvm::handleErrors(), llvm::lsp::Method, llvm::lsp::Parameter, and parse().
bool MessageHandler::onCall | ( | llvm::StringRef | Method, |
llvm::json::Value | Params, | ||
llvm::json::Value | Id ) |
Definition at line 101 of file Transport.cpp.
References llvm::lsp::Logger::info(), llvm::make_error(), llvm::lsp::Method, and llvm::lsp::MethodNotFound.
bool MessageHandler::onNotify | ( | llvm::StringRef | Method, |
llvm::json::Value | Value ) |
Definition at line 86 of file Transport.cpp.
References llvm::lsp::Logger::info(), llvm::lsp::Method, and llvm::lsp::Value.
bool MessageHandler::onReply | ( | llvm::json::Value | Id, |
llvm::Expected< llvm::json::Value > | Result ) |
Definition at line 117 of file Transport.cpp.
References llvm::consumeError(), llvm::debugString(), llvm::lsp::Logger::error(), and llvm::lsp::Logger::info().
|
inline |
Create an OutgoingNotification object used for the given method.
Definition at line 219 of file Transport.h.
References llvm::lsp::Logger::info(), llvm::lsp::Method, and T.
|
inline |
Create an OutgoingRequest function that, when called, sends a request with the given method via the transport.
Should the outgoing request be met with a response, the result JSON is parsed and the response callback is invoked.
Definition at line 233 of file Transport.h.
References llvm::debugString(), llvm::formatv(), llvm::lsp::Logger::info(), llvm::lsp::Method, llvm::lsp::Parameter, parse(), and llvm::lsp::Value.
|
inlinestatic |
Definition at line 166 of file Transport.h.
References llvm::fmt_consume(), llvm::formatv(), llvm::lsp::fromJSON(), llvm::json::Path::Root::getError(), llvm::lsp::InvalidParams, llvm::make_error(), llvm::json::Path::Root::printErrorContext(), and T.
Referenced by method(), notification(), and outgoingRequest().