MLIR
20.0.0git
|
A handler used to process the incoming transport messages. More...
#include "mlir/Tools/lsp-server-support/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. More... | |
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. More... | |
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 117 of file Transport.h.
|
inline |
Definition at line 119 of file Transport.h.
|
inline |
Definition at line 146 of file Transport.h.
Referenced by notification(), onCall(), onNotify(), outgoingNotification(), outgoingRequest(), mlir::lsp::runMlirLSPServer(), mlir::lsp::runPdllLSPServer(), and mlir::lsp::runTableGenLSPServer().
|
inline |
Definition at line 159 of file Transport.h.
References method().
Referenced by mlir::lsp::runMlirLSPServer(), mlir::lsp::runPdllLSPServer(), and mlir::lsp::runTableGenLSPServer().
bool MessageHandler::onCall | ( | StringRef | method, |
llvm::json::Value | params, | ||
llvm::json::Value | id | ||
) |
Definition at line 102 of file Transport.cpp.
References mlir::lsp::Logger::info(), method(), and mlir::lsp::MethodNotFound.
bool MessageHandler::onNotify | ( | StringRef | method, |
llvm::json::Value | value | ||
) |
Definition at line 87 of file Transport.cpp.
References mlir::lsp::Logger::info(), and method().
bool MessageHandler::onReply | ( | llvm::json::Value | id, |
llvm::Expected< llvm::json::Value > | result | ||
) |
Definition at line 118 of file Transport.cpp.
References mlir::debugString(), mlir::lsp::Logger::error(), and mlir::lsp::Logger::info().
|
inline |
Create an OutgoingNotification object used for the given method.
Definition at line 178 of file Transport.h.
References mlir::lsp::Logger::info(), method(), and mlir::lsp::JSONTransport::notify().
Referenced by mlir::lsp::runMlirLSPServer(), mlir::lsp::runPdllLSPServer(), and mlir::lsp::runTableGenLSPServer().
|
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 192 of file Transport.h.
References mlir::lsp::JSONTransport::call(), mlir::debugString(), mlir::lsp::Logger::info(), and method().
|
inlinestatic |
Definition at line 126 of file Transport.h.
References mlir::lsp::fromJSON(), and mlir::lsp::InvalidParams.