docs(lua): don't include remote-only API functions (#26266)

This commit is contained in:
zeertzjq 2023-11-28 13:52:17 +08:00 committed by GitHub
parent e6d38c7dac
commit 570367ac83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 204 deletions

View File

@ -286,12 +286,6 @@ function vim.api.nvim_buf_del_var(buffer, name) end
--- • unload: Unloaded only, do not delete. See `:bunload`
function vim.api.nvim_buf_delete(buffer, opts) end
--- Deactivates buffer-update events on the channel.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @return boolean
function vim.api.nvim_buf_detach(buffer) end
--- Gets a changed tick of a buffer
---
--- @param buffer integer Buffer handle, or 0 for current buffer
@ -682,22 +676,6 @@ function vim.api.nvim_buf_set_var(buffer, name, value) end
--- @return integer
function vim.api.nvim_buf_set_virtual_text(buffer, src_id, line, chunks, opts) end
--- Calls many API methods atomically.
--- This has two main usages:
--- 1. To perform several requests from an async context atomically, i.e.
--- without interleaving redraws, RPC requests from other clients, or user
--- interactions (however API methods may trigger autocommands or event
--- processing which have such side effects, e.g. `:sleep` may wake
--- timers).
--- 2. To minimize RPC overhead (roundtrips) of a sequence of many requests.
---
---
--- @param calls any[] an array of calls, where each call is described by an array
--- with two elements: the request name, and an array of
--- arguments.
--- @return any[]
function vim.api.nvim_call_atomic(calls) end
--- Calls a Vimscript `Dictionary-function` with the given arguments.
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
@ -1019,10 +997,6 @@ function vim.api.nvim_err_write(str) end
--- @param str string Message
function vim.api.nvim_err_writeln(str) end
--- @param lvl integer
--- @param data string
function vim.api.nvim_error_event(lvl, data) end
--- Evaluates a Vimscript `expression`. Dictionaries and Lists are recursively
--- expanded.
--- On execution error: fails with Vimscript error, updates v:errmsg.
@ -1087,22 +1061,6 @@ function vim.api.nvim_exec2(src, opts) end
--- callback. See `nvim_create_autocmd()` for details.
function vim.api.nvim_exec_autocmds(event, opts) end
--- Execute Lua code. Parameters (if any) are available as `...` inside the
--- chunk. The chunk can return a value.
--- Only statements are executed. To evaluate an expression, prefix it with
--- `return`: return my_function(...)
---
--- @param code string Lua code to execute
--- @param args any[] Arguments to the code
--- @return any
function vim.api.nvim_exec_lua(code, args) end
--- @deprecated
--- @param code string
--- @param args any[]
--- @return any
function vim.api.nvim_execute_lua(code, args) end
--- Sends input-keys to Nvim, subject to various quirks controlled by `mode`
--- flags. This is a blocking call, unlike `nvim_input()`.
--- On execution error: does not fail, but updates v:errmsg.
@ -1130,12 +1088,6 @@ function vim.api.nvim_feedkeys(keys, mode, escape_ks) end
--- @return table<string,any>
function vim.api.nvim_get_all_options_info() end
--- Returns a 2-tuple (Array), where item 0 is the current channel id and item
--- 1 is the `api-metadata` map (Dictionary).
---
--- @return any[]
function vim.api.nvim_get_api_info() end
--- Get all autocommands that match the corresponding {opts}.
--- These examples will get autocommands matching ALL the given criteria:
---
@ -1733,59 +1685,6 @@ function vim.api.nvim_replace_termcodes(str, from_part, do_lt, special) end
--- @param opts table<string,any> Optional parameters. Reserved for future use.
function vim.api.nvim_select_popupmenu_item(item, insert, finish, opts) end
--- Self-identifies the client.
--- The client/plugin/application should call this after connecting, to
--- provide hints about its identity and purpose, for debugging and
--- orchestration.
--- Can be called more than once; the caller should merge old info if
--- appropriate. Example: library first identifies the channel, then a plugin
--- using that library later identifies itself.
---
--- @param name string Short name for the connected client
--- @param version table<string,any> Dictionary describing the version, with these (optional)
--- keys:
--- • "major" major version (defaults to 0 if not set, for
--- no release yet)
--- • "minor" minor version
--- • "patch" patch number
--- • "prerelease" string describing a prerelease, like
--- "dev" or "beta1"
--- • "commit" hash or similar identifier of commit
--- @param type string Must be one of the following values. Client libraries
--- should default to "remote" unless overridden by the
--- user.
--- • "remote" remote client connected "Nvim flavored"
--- MessagePack-RPC (responses must be in reverse order of
--- requests). `msgpack-rpc`
--- • "msgpack-rpc" remote client connected to Nvim via
--- fully MessagePack-RPC compliant protocol.
--- • "ui" gui frontend
--- • "embedder" application using Nvim as a component (for
--- example, IDE/editor implementing a vim mode).
--- • "host" plugin host, typically started by nvim
--- • "plugin" single plugin, started by nvim
--- @param methods table<string,any> Builtin methods in the client. For a host, this does not
--- include plugin methods which will be discovered later.
--- The key should be the method name, the values are dicts
--- with these (optional) keys (more keys may be added in
--- future versions of Nvim, thus unknown keys are ignored.
--- Clients must only use keys defined in this or later
--- versions of Nvim):
--- • "async" if true, send as a notification. If false or
--- unspecified, use a blocking request
--- • "nargs" Number of arguments. Could be a single integer
--- or an array of two integers, minimum and maximum
--- inclusive.
--- @param attributes table<string,any> Arbitrary string:string map of informal client
--- properties. Suggested keys:
--- • "website": Client homepage URL (e.g. GitHub
--- repository)
--- • "license": License description ("Apache 2", "GPLv3",
--- "MIT", …)
--- • "logo": URI or path to image, preferably small logo or
--- icon. .png or .svg format is preferred.
function vim.api.nvim_set_client_info(name, version, type, methods, attributes) end
--- Sets the current buffer.
---
--- @param buffer integer Buffer handle
@ -1973,11 +1872,6 @@ function vim.api.nvim_set_vvar(name, value) end
--- @return integer
function vim.api.nvim_strwidth(text) end
--- Subscribes to event broadcasts.
---
--- @param event string Event type string
function vim.api.nvim_subscribe(event) end
--- Removes a tab-scoped (t:) variable
---
--- @param tabpage integer Tabpage handle, or 0 for current tabpage
@ -2022,79 +1916,6 @@ function vim.api.nvim_tabpage_list_wins(tabpage) end
--- @param value any Variable value
function vim.api.nvim_tabpage_set_var(tabpage, name, value) end
--- Activates UI events on the channel.
--- Entry point of all UI clients. Allows `--embed` to continue startup.
--- Implies that the client is ready to show the UI. Adds the client to the
--- list of UIs. `nvim_list_uis()`
---
--- @param width integer Requested screen columns
--- @param height integer Requested screen rows
--- @param options table<string,any> `ui-option` map
function vim.api.nvim_ui_attach(width, height, options) end
--- Deactivates UI events on the channel.
--- Removes the client from the list of UIs. `nvim_list_uis()`
---
function vim.api.nvim_ui_detach() end
--- Tells Nvim the geometry of the popupmenu, to align floating windows with
--- an external popup menu.
--- Note that this method is not to be confused with
--- `nvim_ui_pum_set_height()`, which sets the number of visible items in the
--- popup menu, while this function sets the bounding box of the popup menu,
--- including visual elements such as borders and sliders. Floats need not use
--- the same font size, nor be anchored to exact grid corners, so one can set
--- floating-point numbers to the popup menu geometry.
---
--- @param width number Popupmenu width.
--- @param height number Popupmenu height.
--- @param row number Popupmenu row.
--- @param col number Popupmenu height.
function vim.api.nvim_ui_pum_set_bounds(width, height, row, col) end
--- Tells Nvim the number of elements displaying in the popupmenu, to decide
--- <PageUp> and <PageDown> movement.
---
--- @param height integer Popupmenu height, must be greater than zero.
function vim.api.nvim_ui_pum_set_height(height) end
--- @param gained boolean
function vim.api.nvim_ui_set_focus(gained) end
--- @param name string
--- @param value any
function vim.api.nvim_ui_set_option(name, value) end
--- Tells Nvim when a terminal event has occurred
--- The following terminal events are supported:
---
--- • "termresponse": The terminal sent an OSC or DCS response sequence to
--- Nvim. The payload is the received response. Sets `v:termresponse` and
--- fires `TermResponse`.
---
---
--- @param event string Event name
--- @param value any
function vim.api.nvim_ui_term_event(event, value) end
--- @param width integer
--- @param height integer
function vim.api.nvim_ui_try_resize(width, height) end
--- Tell Nvim to resize a grid. Triggers a grid_resize event with the
--- requested grid size or the maximum size if it exceeds size limits.
--- On invalid grid handle, fails with error.
---
--- @param grid integer The handle of the grid to be changed.
--- @param width integer The new requested width.
--- @param height integer The new requested height.
function vim.api.nvim_ui_try_resize_grid(grid, width, height) end
--- Unsubscribes to event broadcasts.
---
--- @param event string Event type string
function vim.api.nvim_unsubscribe(event) end
--- Calls a function with window as temporary current window.
---
--- @param window integer Window handle, or 0 for current window

View File

@ -178,34 +178,36 @@ local function get_api_meta()
local doc_metadata = vim.mpack.decode(doc_mpack_f:read('*all')) --[[@as table<string,vim.gen_vim_doc_fun>]]
for _, fun in ipairs(metadata) do
local fdoc = doc_metadata[fun.name]
if fun.lua then
local fdoc = doc_metadata[fun.name]
local params = {} --- @type {[1]:string,[2]:string}[]
for _, p in ipairs(fun.parameters) do
local ptype, pname = p[1], p[2]
params[#params + 1] = {
pname,
api_type(ptype),
fdoc and fdoc.parameters_doc[pname] or nil,
}
end
local r = {
signature = 'NA',
name = fun.name,
params = params,
returns = api_type(fun.return_type),
deprecated = fun.deprecated_since ~= nil,
}
if fdoc then
if #fdoc.doc > 0 then
r.desc = table.concat(fdoc.doc, '\n')
local params = {} --- @type {[1]:string,[2]:string}[]
for _, p in ipairs(fun.parameters) do
local ptype, pname = p[1], p[2]
params[#params + 1] = {
pname,
api_type(ptype),
fdoc and fdoc.parameters_doc[pname] or nil,
}
end
r.return_desc = (fdoc['return'] or {})[1]
end
ret[fun.name] = r
local r = {
signature = 'NA',
name = fun.name,
params = params,
returns = api_type(fun.return_type),
deprecated = fun.deprecated_since ~= nil,
}
if fdoc then
if #fdoc.doc > 0 then
r.desc = table.concat(fdoc.doc, '\n')
end
r.return_desc = (fdoc['return'] or {})[1]
end
ret[fun.name] = r
end
end
return ret
end