} // namespace
void clangd::reply(json::Value &&Result) {
- auto ID = getRequestId();
+ auto ID = Context::current().get(RequestID);
if (!ID) {
elog("Attempted to reply to a notification!");
return;
{"message", Message.str()}};
});
- if (auto ID = getRequestId()) {
+ if (auto ID = Context::current().get(RequestID)) {
log("--> reply({0}) error: {1}", *ID, Message);
Context::current()
.getExisting(CurrentTransport)
WithContextValue WithTransport(CurrentTransport, &Transport);
return Transport.loop(*this);
}
-
-const json::Value *clangd::getRequestId() {
- return Context::current().get(RequestID);
-}
/// fetches the related message from error's message method. If error doesn't
/// match any known errors, uses ErrorCode::InvalidParams for the error.
void replyError(llvm::Error E);
-/// Returns the request-id of the current request. Should not be used directly
-/// for replying to requests, use the above mentioned methods for that case.
-const llvm::json::Value *getRequestId();
/// Sends a request to the client.
/// Current context must derive from JSONRPCDispatcher::Handler.
void call(llvm::StringRef Method, llvm::json::Value &&Params);