From 8ed54bbec3b07d16658547d6bf38a1e804800341 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Thu, 24 Jan 2019 19:15:39 +0100 Subject: messages: use proper multiline error message for rpcrequest and API wrappers --- src/nvim/msgpack_rpc/channel.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/nvim/msgpack_rpc/channel.c') diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 3438949e2d..2f3af22b65 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -687,6 +687,22 @@ Dictionary rpc_client_info(Channel *chan) return copy_dictionary(chan->rpc.info); } +const char *rpc_client_name(Channel *chan) +{ + if (!chan->is_rpc) { + return NULL; + } + Dictionary info = chan->rpc.info; + for (size_t i = 0; i < info.size; i++) { + if (strequal("name", info.items[i].key.data) + && info.items[i].value.type == kObjectTypeString) { + return info.items[i].value.data.string.data; + } + } + + return NULL; +} + #if MIN_LOG_LEVEL <= DEBUG_LOG_LEVEL #define REQ "[request] " #define RES "[response] " -- cgit