aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/msgpack_rpc/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/msgpack_rpc/channel.c')
-rw-r--r--src/nvim/msgpack_rpc/channel.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index b6ac3fab82..4c35cce09a 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -10,6 +10,7 @@
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/msgpack_rpc/channel.h"
+#include "nvim/msgpack_rpc/remote_ui.h"
#include "nvim/os/event.h"
#include "nvim/os/rstream.h"
#include "nvim/os/rstream_defs.h"
@@ -100,6 +101,17 @@ void channel_init(void)
if (embedded_mode) {
channel_from_stdio();
}
+
+ if (abstract_ui) {
+ // Add handler for "attach_ui"
+ remote_ui_init();
+ String method = cstr_as_string("attach_ui");
+ MsgpackRpcRequestHandler handler = {.fn = remote_ui_attach, .defer = true};
+ msgpack_rpc_add_method_handler(method, handler);
+ method = cstr_as_string("detach_ui");
+ handler.fn = remote_ui_detach;
+ msgpack_rpc_add_method_handler(method, handler);
+ }
}
/// Teardown the module
@@ -645,6 +657,10 @@ static void on_stdio_close(Event e)
static void free_channel(Channel *channel)
{
+ if (abstract_ui) {
+ remote_ui_disconnect(channel->id);
+ }
+
pmap_del(uint64_t)(channels, channel->id);
msgpack_unpacker_free(channel->unpacker);