LLVM 22.0.0git
llvm::lsp::MessageHandler Class Reference

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< ToutgoingNotification (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< Tparse (const llvm::json::Value &Raw, StringRef PayloadName, StringRef PayloadKind)

Detailed Description

A handler used to process the incoming transport messages.

Definition at line 157 of file Transport.h.

Constructor & Destructor Documentation

◆ MessageHandler()

llvm::lsp::MessageHandler::MessageHandler ( JSONTransport & Transport)
inline

Definition at line 159 of file Transport.h.

Member Function Documentation

◆ method()

template<typename Param, typename Result, typename ThisT>
void llvm::lsp::MessageHandler::method ( llvm::StringLiteral Method,
ThisT * ThisPtr,
void(ThisT::* Handler )(const Param &, Callback< Result >) )
inline

Definition at line 186 of file Transport.h.

References llvm::lsp::Method, llvm::lsp::Parameter, and parse().

◆ notification()

template<typename Param, typename ThisT>
void llvm::lsp::MessageHandler::notification ( llvm::StringLiteral Method,
ThisT * ThisPtr,
void(ThisT::* Handler )(const Param &) )
inline

◆ onCall()

bool MessageHandler::onCall ( llvm::StringRef Method,
llvm::json::Value Params,
llvm::json::Value Id )

◆ onNotify()

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.

◆ onReply()

◆ outgoingNotification()

template<typename T>
OutgoingNotification< T > llvm::lsp::MessageHandler::outgoingNotification ( llvm::StringLiteral Method)
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.

◆ outgoingRequest()

template<typename Param, typename Result>
OutgoingRequest< Param > llvm::lsp::MessageHandler::outgoingRequest ( llvm::StringLiteral Method,
OutgoingRequestCallback< Result > Callback )
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.

◆ parse()

template<typename T>
llvm::Expected< T > llvm::lsp::MessageHandler::parse ( const llvm::json::Value & Raw,
StringRef PayloadName,
StringRef PayloadKind )
inlinestatic

The documentation for this class was generated from the following files: