From b162adbb7ca4f980e938a4a06a49218a9ed496cf Mon Sep 17 00:00:00 2001 From: nikolightsaber <103886134+nikolightsaber@users.noreply.github.com> Date: Thu, 8 Feb 2024 11:59:31 +0100 Subject: feat(api): pass 0 to nvim_get_chan_info for current channel (#27321) Getting current channel info was kind of annoying via RPC. Two functions had to be called: 1. `nvim_get_api_info` which returns `[channel_id, meta_data]`. - This results in `channel_id = api.nvim_get_api_info()[0]`. - Here the meta_data is sent but never used. 2. Finally call `nvim_get_chan_info(channel_id)`. This commit reduces the need for `nvim_get_api_info` as passing 0 returns current channel info. --- runtime/doc/api.txt | 3 +++ runtime/doc/news.txt | 2 ++ 2 files changed, 5 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 89d2860ad2..95bcb31db9 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -888,6 +888,9 @@ nvim_get_api_info() *nvim_get_api_info()* nvim_get_chan_info({chan}) *nvim_get_chan_info()* Gets information about a channel. + Parameters: ~ + • {chan} channel_id, or 0 for current channel + Return: ~ Dictionary describing a channel, with these keys: • "id" Channel id. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index c67713b657..1a1b4f5ed5 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -405,6 +405,8 @@ The following changes to existing APIs or features add new behavior. • Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer gives an error. +• Passing 0 to |nvim_get_chan_info()| gets info about the current channel. + • |:checkhealth| buffer can now be opened in a split window using modifiers like |:vertical|, |:horizontal| and |:botright|. -- cgit