MLIR  16.0.0git
Public Member Functions | Static Public Member Functions | List of all members
mlir::lsp::MessageHandler Class Reference

A handler used to process the incoming transport messages. More...

#include "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...
 

Static Public Member Functions

template<typename T >
static llvm::Expected< T > parse (const llvm::json::Value &raw, StringRef payloadName, StringRef payloadKind)
 

Detailed Description

A handler used to process the incoming transport messages.

Definition at line 104 of file Transport.h.

Constructor & Destructor Documentation

◆ MessageHandler()

mlir::lsp::MessageHandler::MessageHandler ( JSONTransport transport)
inline

Definition at line 106 of file Transport.h.

References value.

Member Function Documentation

◆ method()

template<typename Param , typename Result , typename ThisT >
void mlir::lsp::MessageHandler::method ( llvm::StringLiteral  method,
ThisT *  thisPtr,
void(ThisT::*)(const Param &, Callback< Result >)  handler 
)
inline

◆ notification()

template<typename Param , typename ThisT >
void mlir::lsp::MessageHandler::notification ( llvm::StringLiteral  method,
ThisT *  thisPtr,
void(ThisT::*)(const Param &)  handler 
)
inline

◆ onCall()

bool MessageHandler::onCall ( StringRef  method,
llvm::json::Value  params,
llvm::json::Value  id 
)

Definition at line 96 of file Transport.cpp.

References mlir::lsp::Logger::info(), and mlir::lsp::MethodNotFound.

Referenced by mlir::lsp::JSONTransport::run().

◆ onNotify()

bool MessageHandler::onNotify ( StringRef  method,
llvm::json::Value  value 
)

Definition at line 81 of file Transport.cpp.

References mlir::lsp::Logger::info().

Referenced by mlir::lsp::JSONTransport::run().

◆ onReply()

bool MessageHandler::onReply ( llvm::json::Value  id,
llvm::Expected< llvm::json::Value >  result 
)

Definition at line 112 of file Transport.cpp.

References mlir::lsp::Logger::error().

Referenced by mlir::lsp::JSONTransport::run().

◆ outgoingNotification()

template<typename T >
OutgoingNotification<T> mlir::lsp::MessageHandler::outgoingNotification ( llvm::StringLiteral  method)
inline

Create an OutgoingNotification object used for the given method.

Definition at line 159 of file Transport.h.

References mlir::lsp::Logger::info().

Referenced by mlir::lsp::runMlirLSPServer(), mlir::lsp::runPdllLSPServer(), and mlir::lsp::runTableGenLSPServer().

◆ parse()

template<typename T >
static llvm::Expected<T> mlir::lsp::MessageHandler::parse ( const llvm::json::Value &  raw,
StringRef  payloadName,
StringRef  payloadKind 
)
inlinestatic

Definition at line 113 of file Transport.h.

References mlir::lsp::fromJSON(), and mlir::lsp::InvalidParams.


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