6#include <llvm/ADT/FunctionExtras.h>
7#include <llvm/ADT/StringMap.h>
8#include <llvm/Support/JSON.h>
13llvm::Expected<T>
parseParam(
const llvm::json::Value &Raw,
17 llvm::json::Path::Root
Root;
24 Root.printErrorContext(Raw,
OS);
27 return llvm::make_error<LSPError>(
36inline llvm::Expected<llvm::json::Value>
43 using JSON = llvm::json::Value;
44 template <
typename HandlerT>
45 using HandlerMap = llvm::StringMap<llvm::unique_function<HandlerT>>;
56 template <
typename Param,
typename Result,
typename ThisT>
63 return Reply(P.takeError());
72 template <
typename Param,
typename ThisT>
78 return llvm::consumeError(P.takeError());
87 template <
typename Param,
typename Result,
typename ThisT>
94 return Reply(P.takeError());
Whether current platform treats paths case insensitively.
llvm::unique_function< void(llvm::Expected< T >)> Callback
llvm::Expected< T > parseParam(const llvm::json::Value &Raw, llvm::StringRef PayloadName, llvm::StringRef PayloadKind)
bool fromJSON(const llvm::json::Value &, URIForFile &, llvm::json::Path)
void elog(const char *Fmt, Ts &&...Vals)
void vlog(const char *Fmt, Ts &&...Vals)
void addMethod(llvm::StringRef Method, ThisT *This, void(ThisT::*Handler)(const Param &, Callback< Result >))
llvm::StringMap< llvm::unique_function< HandlerT > > HandlerMap
void addNotification(llvm::StringLiteral Method, ThisT *This, void(ThisT::*Handler)(const Param &))
HandlerMap< void(JSON)> NotificationHandlers
HandlerMap< void(JSON, Callback< JSON >)> MethodHandlers
void addCommand(llvm::StringLiteral Command, ThisT *This, void(ThisT::*Handler)(const Param &, Callback< Result >))
HandlerMap< void(JSON, Callback< JSON >)> CommandHandlers