docs(vvars): fix wrong lua types in vim.v variables

- cmdarg: string[] -> string
- shell_error: string -> int
- stderr: string -> int

- Add types for: cmdbang, errors, exception, false, true
This commit is contained in:
Jongwook Choi 2024-01-06 08:59:50 -05:00 committed by Lewis Russell
parent 967c7abde3
commit fa836cb98b
2 changed files with 16 additions and 11 deletions

View File

@ -34,14 +34,14 @@ vim.v.charconvert_to = ...
--- leading space to make it possible to append this variable --- leading space to make it possible to append this variable
--- directly after the read/write command. Note: "+cmd" isn't --- directly after the read/write command. Note: "+cmd" isn't
--- included here, because it will be executed anyway. --- included here, because it will be executed anyway.
--- @type string[] --- @type string
vim.v.cmdarg = ... vim.v.cmdarg = ...
--- Set like v:cmdarg for a file read/write command. When a "!" --- Set like v:cmdarg for a file read/write command. When a "!"
--- was used the value is 1, otherwise it is 0. Note that this --- was used the value is 1, otherwise it is 0. Note that this
--- can only be used in autocommands. For user commands `<bang>` --- can only be used in autocommands. For user commands `<bang>`
--- can be used. --- can be used.
--- @type any --- @type integer
vim.v.cmdbang = ... vim.v.cmdbang = ...
--- The current locale setting for collation order of the runtime --- The current locale setting for collation order of the runtime
@ -141,7 +141,7 @@ vim.v.errmsg = ...
--- ---
--- If v:errors is set to anything but a list it is made an empty --- If v:errors is set to anything but a list it is made an empty
--- list by the assert function. --- list by the assert function.
--- @type any --- @type string[]
vim.v.errors = ... vim.v.errors = ...
--- Dictionary of event data for the current `autocommand`. Valid --- Dictionary of event data for the current `autocommand`. Valid
@ -210,7 +210,7 @@ vim.v.event = ...
--- ``` --- ```
--- ---
--- Output: "caught oops". --- Output: "caught oops".
--- @type any --- @type string
vim.v.exception = ... vim.v.exception = ...
--- Exit code, or `v:null` before invoking the `VimLeavePre` --- Exit code, or `v:null` before invoking the `VimLeavePre`
@ -228,7 +228,7 @@ vim.v.exiting = ...
--- as a String (e.g. in `expr5` with string concatenation --- as a String (e.g. in `expr5` with string concatenation
--- operator) and to zero when used as a Number (e.g. in `expr5` --- operator) and to zero when used as a Number (e.g. in `expr5`
--- or `expr7` when used with numeric operators). Read-only. --- or `expr7` when used with numeric operators). Read-only.
--- @type any --- @type boolean
vim.v['false'] = ... vim.v['false'] = ...
--- What should happen after a `FileChangedShell` event was --- What should happen after a `FileChangedShell` event was
@ -608,7 +608,7 @@ vim.v.servername = ...
--- echo 'could not rename "foo" to "bar"!' --- echo 'could not rename "foo" to "bar"!'
--- endif --- endif
--- ``` --- ```
--- @type string --- @type integer
vim.v.shell_error = ... vim.v.shell_error = ...
--- Last given status message. --- Last given status message.
@ -624,7 +624,7 @@ vim.v.statusmsg = ...
--- ```vim --- ```vim
--- :call chansend(v:stderr, "error: toaster empty\n") --- :call chansend(v:stderr, "error: toaster empty\n")
--- ``` --- ```
--- @type string --- @type integer
vim.v.stderr = ... vim.v.stderr = ...
--- `SwapExists` autocommands can set this to the selected choice --- `SwapExists` autocommands can set this to the selected choice
@ -733,7 +733,7 @@ vim.v.throwpoint = ...
--- as a String (e.g. in `expr5` with string concatenation --- as a String (e.g. in `expr5` with string concatenation
--- operator) and to one when used as a Number (e.g. in `expr5` or --- operator) and to one when used as a Number (e.g. in `expr5` or
--- `expr7` when used with numeric operators). Read-only. --- `expr7` when used with numeric operators). Read-only.
--- @type any --- @type boolean
vim.v['true'] = ... vim.v['true'] = ...
--- Value of the current item of a `List` or `Dictionary`. Only --- Value of the current item of a `List` or `Dictionary`. Only

View File

@ -31,7 +31,7 @@ M.vars = {
]=], ]=],
}, },
cmdarg = { cmdarg = {
type = 'string[]', type = 'string',
desc = [=[ desc = [=[
The extra arguments ("++p", "++enc=", "++ff=") given to a file The extra arguments ("++p", "++enc=", "++ff=") given to a file
read/write command. This is set before an autocommand event read/write command. This is set before an autocommand event
@ -54,6 +54,7 @@ M.vars = {
]=], ]=],
}, },
cmdbang = { cmdbang = {
type = 'integer',
desc = [=[ desc = [=[
Set like v:cmdarg for a file read/write command. When a "!" Set like v:cmdarg for a file read/write command. When a "!"
was used the value is 1, otherwise it is 0. Note that this was used the value is 1, otherwise it is 0. Note that this
@ -149,6 +150,7 @@ M.vars = {
]=], ]=],
}, },
errors = { errors = {
type = 'string[]',
tags = { 'assert-return' }, tags = { 'assert-return' },
desc = [=[ desc = [=[
Errors found by assert functions, such as |assert_true()|. Errors found by assert functions, such as |assert_true()|.
@ -215,6 +217,7 @@ M.vars = {
]=], ]=],
}, },
exception = { exception = {
type = 'string',
desc = [=[ desc = [=[
The value of the exception most recently caught and not The value of the exception most recently caught and not
finished. See also |v:throwpoint| and |throw-variables|. finished. See also |v:throwpoint| and |throw-variables|.
@ -229,6 +232,7 @@ M.vars = {
]=], ]=],
}, },
['false'] = { ['false'] = {
type = 'boolean',
desc = [=[ desc = [=[
Special value used to put "false" in JSON and msgpack. See Special value used to put "false" in JSON and msgpack. See
|json_encode()|. This value is converted to "v:false" when used |json_encode()|. This value is converted to "v:false" when used
@ -670,7 +674,7 @@ M.vars = {
]=], ]=],
}, },
shell_error = { shell_error = {
type = 'string', type = 'integer',
desc = [=[ desc = [=[
Result of the last shell command. When non-zero, the last Result of the last shell command. When non-zero, the last
shell command had an error. When zero, there was no problem. shell command had an error. When zero, there was no problem.
@ -693,7 +697,7 @@ M.vars = {
]=], ]=],
}, },
stderr = { stderr = {
type = 'string', type = 'integer',
desc = [=[ desc = [=[
|channel-id| corresponding to stderr. The value is always 2; |channel-id| corresponding to stderr. The value is always 2;
use this variable to make your code more descriptive. use this variable to make your code more descriptive.
@ -816,6 +820,7 @@ M.vars = {
]=], ]=],
}, },
['true'] = { ['true'] = {
type = 'boolean',
desc = [=[ desc = [=[
Special value used to put "true" in JSON and msgpack. See Special value used to put "true" in JSON and msgpack. See
|json_encode()|. This value is converted to "v:true" when used |json_encode()|. This value is converted to "v:true" when used