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.
This commit is contained in:
nikolightsaber
2024-02-08 11:59:31 +01:00
committed by GitHub
parent 3f2d543ee8
commit b162adbb7c
5 changed files with 16 additions and 3 deletions

View File

@@ -1158,7 +1158,7 @@ function vim.api.nvim_get_autocmds(opts) end
--- Gets information about a channel.
---
--- @param chan integer
--- @param chan integer channel_id, or 0 for current channel
--- @return table<string,any>
function vim.api.nvim_get_chan_info(chan) end