nixd
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
lspserver::HandlerRegistry Struct Reference

#include <LSPBinder.h>

Public Types

using JSON = llvm::json::Value
 
template<typename HandlerT >
using HandlerMap = llvm::StringMap<llvm::unique_function<HandlerT>>
 

Public Member Functions

template<typename Param , typename Result , typename ThisT >
void addMethod (llvm::StringRef Method, ThisT *This, void(ThisT::*Handler)(const Param &, Callback< Result >))
 
template<typename Param , typename ThisT >
void addNotification (llvm::StringLiteral Method, ThisT *This, void(ThisT::*Handler)(const Param &))
 
template<typename Param , typename Result , typename ThisT >
void addCommand (llvm::StringLiteral Command, ThisT *This, void(ThisT::*Handler)(const Param &, Callback< Result >))
 

Public Attributes

HandlerMap< void(JSON)> NotificationHandlers
 
HandlerMap< void(JSON, Callback< JSON >)> MethodHandlers
 
HandlerMap< void(JSON, Callback< JSON >)> CommandHandlers
 

Detailed Description

Definition at line 42 of file LSPBinder.h.

Member Typedef Documentation

◆ HandlerMap

template<typename HandlerT >
using lspserver::HandlerRegistry::HandlerMap = llvm::StringMap<llvm::unique_function<HandlerT>>

Definition at line 45 of file LSPBinder.h.

◆ JSON

Definition at line 43 of file LSPBinder.h.

Member Function Documentation

◆ addCommand()

void lspserver::HandlerRegistry::addCommand ( llvm::StringLiteral Command,
ThisT * This,
void(ThisT::*)(const Param &, Callback< Result >) Handler )
inline

Bind a handler for an LSP command. e.g. command("load", this, &ThisModule::load); Handler should be e.g. void load(const LoadParams&, Callback<LoadResult>); LoadParams must be JSON-parseable and LoadResult must be serializable.

Definition at line 88 of file LSPBinder.h.

References CommandHandlers, and lspserver::fromJSON().

◆ addMethod()

void lspserver::HandlerRegistry::addMethod ( llvm::StringRef Method,
ThisT * This,
void(ThisT::*)(const Param &, Callback< Result >) Handler )
inline

Bind a handler for an LSP method. e.g. method("peek", this, &ThisModule::peek); Handler should be e.g. void peek(const PeekParams&, Callback<PeekResult>); PeekParams must be JSON-parseable and PeekResult must be serializable.

Definition at line 57 of file LSPBinder.h.

References lspserver::fromJSON(), lspserver::Method, and MethodHandlers.

Referenced by nixd::Controller::Controller().

◆ addNotification()

template<typename Param , typename ThisT >
void lspserver::HandlerRegistry::addNotification ( llvm::StringLiteral Method,
ThisT * This,
void(ThisT::*)(const Param &) Handler )
inline

Bind a handler for an LSP notification. e.g. notification("poke", this, &ThisModule::poke); Handler should be e.g. void poke(const PokeParams&); PokeParams must be JSON-parseable.

Definition at line 73 of file LSPBinder.h.

References lspserver::fromJSON(), lspserver::Method, and NotificationHandlers.

Referenced by nixd::Controller::Controller().

Member Data Documentation

◆ CommandHandlers

HandlerMap<void(JSON, Callback<JSON>)> lspserver::HandlerRegistry::CommandHandlers

Definition at line 49 of file LSPBinder.h.

Referenced by addCommand().

◆ MethodHandlers

HandlerMap<void(JSON, Callback<JSON>)> lspserver::HandlerRegistry::MethodHandlers

Definition at line 48 of file LSPBinder.h.

Referenced by addMethod().

◆ NotificationHandlers

HandlerMap<void(JSON)> lspserver::HandlerRegistry::NotificationHandlers

Definition at line 47 of file LSPBinder.h.

Referenced by addNotification().


The documentation for this struct was generated from the following file: