-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nvim_win_get_config returns lua-special-tbl when called from Lua #27277
Comments
That is all functions that can return a dict.
Do you mean |
For the documentation, what I thought of was for those functions that would, if not for vim-script compatibility reasons, return a normal number/table, but because of vim-script compatibility, return a lua-special-tbl (or returns a table that contains a lua-special-tbl). For the inspection, mostly yes: I would also want to include tostring, but I don't know how feasible it is to set metatable.__tostring for lua-special-tbl. |
Hmm in this particular case it is a bug. There is no "compat" going on here but Special dicts for numbers are only for cases where |
The behavior of |
That reasoning is incorrect tho, for the reasons I already mentioned. The type of a float position was intentionally chosen to be a number, not a foreign object of an unknown type. Neither is a "special case" of the other, it is just two different code paths which has always existed (and we fixed bugs like this multiple times in the past) |
Fixed by #27284 |
Problem
Some functions, like
nvim_win_get_config
, have a lua-special-tbl float in the returned values, but what the user sees when inspecting it is a table with the keystrue
andfalse
set to some numbers, which is confusing.Expected behavior
A solution is to add a notice to the documentation of the functions that may have lua-special-tbl in the return value about how the return value may contain lua-special-tbl.
An alternative solution would be to make it so that inspecting a lua-special-tbl would not return the table with boolean keys, but either a string similar to
vim.empty_dict()
, or the table with the keys beingvim.type_idx
andvim.val_idx
instead oftrue
andfalse
The text was updated successfully, but these errors were encountered: