From 7cd22e916bbb86efc5a74a3cc4a7115963c7c3f0 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 29 Mar 2026 06:59:34 -0400 Subject: [PATCH] fix(:connect): formalize connect event #38543 Also document it. --- runtime/doc/api-ui-events.txt | 16 +++++++++++++--- src/nvim/api/ui_events.in.h | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/runtime/doc/api-ui-events.txt b/runtime/doc/api-ui-events.txt index ee719543eb..07cc6efed7 100644 --- a/runtime/doc/api-ui-events.txt +++ b/runtime/doc/api-ui-events.txt @@ -247,10 +247,20 @@ the editor. Indicates to the UI that it must stop rendering the cursor. This event is misnamed and does not actually have anything to do with busyness. +["connect", server_addr] ~ + User invoked the |:connect| command. Nvim detached the current UI. + + UI is expected to: + 1. Attach to the server at `server_addr`. + ["restart", listen_addr] ~ - |:restart| command has been used and the Nvim server is about to exit. - After the current server's channel is closed, the UI should attach to - the new server's listening address at `listen_addr`. + User invoked the |:restart| command. Nvim started a new server. The + old server is about to exit and close its channel. + + UI is expected to: + 1. Wait for the channel to be closed, to confirm that the old server + actually exited. + 2. Attach to the new server at `listen_addr`. ["suspend"] ~ |:suspend| command or |CTRL-Z| mapping is used. A terminal client (or diff --git a/src/nvim/api/ui_events.in.h b/src/nvim/api/ui_events.in.h index 4150e6c8c5..97b5271845 100644 --- a/src/nvim/api/ui_events.in.h +++ b/src/nvim/api/ui_events.in.h @@ -27,7 +27,7 @@ void visual_bell(void) FUNC_API_SINCE(3); void flush(void) FUNC_API_SINCE(3) FUNC_API_REMOTE_IMPL; -void connect(Array args) +void connect(String server_addr) FUNC_API_SINCE(14) FUNC_API_REMOTE_ONLY FUNC_API_REMOTE_IMPL FUNC_API_CLIENT_IMPL; void restart(String listen_addr) FUNC_API_SINCE(14) FUNC_API_REMOTE_ONLY FUNC_API_REMOTE_IMPL FUNC_API_CLIENT_IMPL;