mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
commit
a59330d6fc
@ -1783,6 +1783,7 @@ abs({expr}) Float or Number absolute value of {expr}
|
|||||||
acos({expr}) Float arc cosine of {expr}
|
acos({expr}) Float arc cosine of {expr}
|
||||||
add({list}, {item}) List append {item} to |List| {list}
|
add({list}, {item}) List append {item} to |List| {list}
|
||||||
and({expr}, {expr}) Number bitwise AND
|
and({expr}, {expr}) Number bitwise AND
|
||||||
|
api_info() Dict api metadata
|
||||||
append({lnum}, {string}) Number append {string} below line {lnum}
|
append({lnum}, {string}) Number append {string} below line {lnum}
|
||||||
append({lnum}, {list}) Number append lines {list} below line {lnum}
|
append({lnum}, {list}) Number append lines {list} below line {lnum}
|
||||||
argc() Number number of files in the argument list
|
argc() Number number of files in the argument list
|
||||||
@ -2196,6 +2197,11 @@ and({expr}, {expr}) *and()*
|
|||||||
:let flag = and(bits, 0x80)
|
:let flag = and(bits, 0x80)
|
||||||
|
|
||||||
|
|
||||||
|
api_info() *api_info()*
|
||||||
|
Return Dictionary containing api metadata.
|
||||||
|
See |api-metadata|.
|
||||||
|
|
||||||
|
|
||||||
append({lnum}, {expr}) *append()*
|
append({lnum}, {expr}) *append()*
|
||||||
When {expr} is a |List|: Append each item of the |List| as a
|
When {expr} is a |List|: Append each item of the |List| as a
|
||||||
text line below line {lnum} in the current buffer.
|
text line below line {lnum} in the current buffer.
|
||||||
|
@ -45,7 +45,7 @@ msgpack-rpc details from application developers. The wrappers can be
|
|||||||
automatically generated by reading bundled API metadata from a compiled Nvim
|
automatically generated by reading bundled API metadata from a compiled Nvim
|
||||||
instance.
|
instance.
|
||||||
|
|
||||||
There are two ways to obtain API metadata:
|
There are three ways to obtain API metadata:
|
||||||
|
|
||||||
1. Connect to a running Nvim instance and call `vim_get_api_info` via
|
1. Connect to a running Nvim instance and call `vim_get_api_info` via
|
||||||
msgpack-rpc. This is best for clients written in dynamic languages which
|
msgpack-rpc. This is best for clients written in dynamic languages which
|
||||||
@ -55,8 +55,10 @@ There are two ways to obtain API metadata:
|
|||||||
of msgpack metadata to standard output. This is useful for clients
|
of msgpack metadata to standard output. This is useful for clients
|
||||||
written in statically-compiled languages.
|
written in statically-compiled languages.
|
||||||
|
|
||||||
|
3. In vimscript the metadata is available as |api_info()|.
|
||||||
|
|
||||||
To get a human-readable list of API functions: >
|
To get a human-readable list of API functions: >
|
||||||
:new|put =map(msgpackparse(systemlist('nvim --api-info'))[0].functions, 'v:val.name._VAL[0]')
|
:new|put =map(api_info().functions, 'v:val.name')
|
||||||
<
|
<
|
||||||
To get a formatted dump of the API using python (requires the `pyyaml` and
|
To get a formatted dump of the API using python (requires the `pyyaml` and
|
||||||
`msgpack-python` packages): >
|
`msgpack-python` packages): >
|
||||||
|
@ -6684,6 +6684,7 @@ static struct fst {
|
|||||||
{ "acos", 1, 1, f_acos }, // WJMc
|
{ "acos", 1, 1, f_acos }, // WJMc
|
||||||
{ "add", 2, 2, f_add },
|
{ "add", 2, 2, f_add },
|
||||||
{ "and", 2, 2, f_and },
|
{ "and", 2, 2, f_and },
|
||||||
|
{ "api_info", 0, 0, f_api_info },
|
||||||
{ "append", 2, 2, f_append },
|
{ "append", 2, 2, f_append },
|
||||||
{ "argc", 0, 0, f_argc },
|
{ "argc", 0, 0, f_argc },
|
||||||
{ "argidx", 0, 0, f_argidx },
|
{ "argidx", 0, 0, f_argidx },
|
||||||
@ -7466,6 +7467,15 @@ static void f_and(typval_T *argvars, typval_T *rettv)
|
|||||||
& get_tv_number_chk(&argvars[1], NULL);
|
& get_tv_number_chk(&argvars[1], NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// "api_info()" function
|
||||||
|
static void f_api_info(typval_T *argvars, typval_T *rettv)
|
||||||
|
{
|
||||||
|
Dictionary metadata = api_metadata();
|
||||||
|
object_to_vim(DICTIONARY_OBJ(metadata), rettv, NULL);
|
||||||
|
api_free_dictionary(metadata);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "append(lnum, string/list)" function
|
* "append(lnum, string/list)" function
|
||||||
*/
|
*/
|
||||||
|
@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
|
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
|
local eval = helpers.eval
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
|
|
||||||
describe('Up to MAX_FUNC_ARGS arguments are handled by', function()
|
describe('Up to MAX_FUNC_ARGS arguments are handled by', function()
|
||||||
@ -27,3 +28,11 @@ describe('Up to MAX_FUNC_ARGS arguments are handled by', function()
|
|||||||
eq('Vim(call):E740: Too many arguments for function rpcnotify', ret)
|
eq('Vim(call):E740: Too many arguments for function rpcnotify', ret)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
describe('api_info()', function()
|
||||||
|
before_each(clear)
|
||||||
|
it('has the right keys', function()
|
||||||
|
local api_keys = eval("sort(keys(api_info()))")
|
||||||
|
eq({'error_types', 'functions', 'types'}, api_keys)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user