<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/test/functional/api/command_spec.lua, branch fix_20726</title>
<subtitle>Neovim fork with Rahm's personal hacks.</subtitle>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/'/>
<entry>
<title>fix(api): allow empty Lua table for nested dicts #22268</title>
<updated>2023-02-16T15:07:18+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2023-02-16T15:07:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=09b3432eaff3abcadb56d61b6f247f992b80b63f'/>
<id>09b3432eaff3abcadb56d61b6f247f992b80b63f</id>
<content type='text'>
Problem:
The Lua-API bridge allows Dict params to be empty Lua (list) tables at
the function-signature level. But not for _nested_ Dicts, because they
are not modeled:
https://github.com/neovim/neovim/blob/fae754073289566051433fae74ec65783f9e7a6a/src/nvim/api/keysets.lua#L184
Some API functions like nvim_cmd check for kObjectTypeDictionary and
don't handle the case of empty Lua tables (treated as "Array").

Solution:
Introduce VALIDATE_T_DICT and use it in places where
kObjectTypeDictionary was being checked directly.

fixes #21005</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
The Lua-API bridge allows Dict params to be empty Lua (list) tables at
the function-signature level. But not for _nested_ Dicts, because they
are not modeled:
https://github.com/neovim/neovim/blob/fae754073289566051433fae74ec65783f9e7a6a/src/nvim/api/keysets.lua#L184
Some API functions like nvim_cmd check for kObjectTypeDictionary and
don't handle the case of empty Lua tables (treated as "Array").

Solution:
Introduce VALIDATE_T_DICT and use it in places where
kObjectTypeDictionary was being checked directly.

fixes #21005</pre>
</div>
</content>
</entry>
<entry>
<title>refactor(api): consistent VALIDATE messages #22262</title>
<updated>2023-02-14T19:19:28+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2023-02-14T19:19:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=556f8646c01d1751cf39fe4df9c622899dceab9d'/>
<id>556f8646c01d1751cf39fe4df9c622899dceab9d</id>
<content type='text'>
Problem:
Validation messages are not consistently formatted.
- Parameter names sometimes are NOT quoted.
- Descriptive names (non-parameters) sometimes ARE quoted.

Solution:
Always quote the `name` value passed to a VALIDATE macro _unless_ the
value has whitespace.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
Validation messages are not consistently formatted.
- Parameter names sometimes are NOT quoted.
- Descriptive names (non-parameters) sometimes ARE quoted.

Solution:
Always quote the `name` value passed to a VALIDATE macro _unless_ the
value has whitespace.</pre>
</div>
</content>
</entry>
<entry>
<title>refactor(api): VALIDATE macros #22187</title>
<updated>2023-02-14T10:19:04+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2023-02-14T10:19:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=46a87a5d2bac598fed0870f0d3c926087f95d30f'/>
<id>46a87a5d2bac598fed0870f0d3c926087f95d30f</id>
<content type='text'>
Problem:
- API validation involves too much boilerplate.
- API validation errors are not consistently worded.

Solution:
Introduce some macros. Currently these are clumsy, but they at least
help with consistency and avoid some nesting.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
- API validation involves too much boilerplate.
- API validation errors are not consistently worded.

Solution:
Introduce some macros. Currently these are clumsy, but they at least
help with consistency and avoid some nesting.</pre>
</div>
</content>
</entry>
<entry>
<title>feat(api): add command name to Lua command callback opts</title>
<updated>2022-11-07T16:27:37+00:00</updated>
<author>
<name>Famiu Haque</name>
<email>famiuhaque@protonmail.com</email>
</author>
<published>2022-11-07T16:27:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=c022140ec6a66402e405152054b6ab0141940419'/>
<id>c022140ec6a66402e405152054b6ab0141940419</id>
<content type='text'>
Adds a `name` key to the opts dict passed to Lua command callbacks
created using `nvim_create_user_command()`. This is useful for when
multiple commands use the same callback.

Note that this kind of behavior is not as strange as one might think,
even some internal Neovim commands reuse the same internal C function,
differing their behavior by checking the command name. `substitute`,
`smagic` and `snomagic` are examples of that.

This will also be useful for generalized Lua command preview functions
that can preview a wide range of commands, in which case knowing the
command name is necessary for the preview function to actually be able
to execute the command that it's supposed to preview.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adds a `name` key to the opts dict passed to Lua command callbacks
created using `nvim_create_user_command()`. This is useful for when
multiple commands use the same callback.

Note that this kind of behavior is not as strange as one might think,
even some internal Neovim commands reuse the same internal C function,
differing their behavior by checking the command name. `substitute`,
`smagic` and `snomagic` are examples of that.

This will also be useful for generalized Lua command preview functions
that can preview a wide range of commands, in which case knowing the
command name is necessary for the preview function to actually be able
to execute the command that it's supposed to preview.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lua): fix architecture-dependent behavior in usercmd "reg" (#20384)</title>
<updated>2022-09-28T10:27:59+00:00</updated>
<author>
<name>zeertzjq</name>
<email>zeertzjq@outlook.com</email>
</author>
<published>2022-09-28T10:27:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=35e2c4a2edd28f72c48c70530c5486365c2502a4'/>
<id>35e2c4a2edd28f72c48c70530c5486365c2502a4</id>
<content type='text'>
I don't think using an integer as a NUL-terminated string can work on
big-endian systems, at least.

This is also not tested. Add a test.

Also fix a mistake in the docs of nvim_parse_cmd.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I don't think using an integer as a NUL-terminated string can work on
big-endian systems, at least.

This is also not tested. Add a test.

Also fix a mistake in the docs of nvim_parse_cmd.</pre>
</div>
</content>
</entry>
<entry>
<title>fix(api)!: correctly deal with number before :tab</title>
<updated>2022-09-02T14:28:57+00:00</updated>
<author>
<name>zeertzjq</name>
<email>zeertzjq@outlook.com</email>
</author>
<published>2022-09-01T10:46:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=1ef7720567b08caec0c077605fb2a01a9d6eafbc'/>
<id>1ef7720567b08caec0c077605fb2a01a9d6eafbc</id>
<content type='text'>
Now nvim_parse_cmd and nvim_create_user_command use a "tab" value which
is the same as the number passed before :tab modifier instead of the
number plus 1, and "tab" value is -1 if :tab modifier is not used.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now nvim_parse_cmd and nvim_create_user_command use a "tab" value which
is the same as the number passed before :tab modifier instead of the
number plus 1, and "tab" value is -1 if :tab modifier is not used.
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(api): add support for :horizontal modifier</title>
<updated>2022-09-01T12:53:43+00:00</updated>
<author>
<name>zeertzjq</name>
<email>zeertzjq@outlook.com</email>
</author>
<published>2022-09-01T12:32:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=689f5d604e59eba1ddab6f91b458a8163dc6629d'/>
<id>689f5d604e59eba1ddab6f91b458a8163dc6629d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(usercmd): also check for whitespace after escaped character (#19942)</title>
<updated>2022-08-25T09:57:32+00:00</updated>
<author>
<name>zeertzjq</name>
<email>zeertzjq@outlook.com</email>
</author>
<published>2022-08-25T09:57:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=274e1122ade42095cd5b6416e70bda3aa0cb0423'/>
<id>274e1122ade42095cd5b6416e70bda3aa0cb0423</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(api/command): fargs behavior when no arguments are passed (#19862)</title>
<updated>2022-08-21T13:19:29+00:00</updated>
<author>
<name>Javier Lopez</name>
<email>graulopezjavier@gmail.com</email>
</author>
<published>2022-08-21T13:19:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=dde90f0ca4e394667afe39c18f4a4dabdd8a6666'/>
<id>dde90f0ca4e394667afe39c18f4a4dabdd8a6666</id>
<content type='text'>
Problem: A command defined with `nargs="?"` returns `fargs={""}` to
a Lua callback when executed with no arguments, which is inconsistent
with how`nargs="*"` behaves.

Solution: Pass `fargs={}` for no argument with `nargs="?"` as well.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: A command defined with `nargs="?"` returns `fargs={""}` to
a Lua callback when executed with no arguments, which is inconsistent
with how`nargs="*"` behaves.

Solution: Pass `fargs={}` for no argument with `nargs="?"` as well.</pre>
</div>
</content>
</entry>
<entry>
<title>feat(api): add `unsilent` to command APIs</title>
<updated>2022-07-02T20:34:28+00:00</updated>
<author>
<name>zeertzjq</name>
<email>zeertzjq@outlook.com</email>
</author>
<published>2022-07-02T11:35:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=7a907c3314f939a3d2983ac07edc5c9672957352'/>
<id>7a907c3314f939a3d2983ac07edc5c9672957352</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
