Giter Site home page Giter Site logo

Comments (6)

zeertzjq avatar zeertzjq commented on May 20, 2024 3

Fixed by #27284

from neovim.

bfredl avatar bfredl commented on May 20, 2024 2

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)

from neovim.

justinmk avatar justinmk commented on May 20, 2024

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

That is all functions that can return a dict.

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 being vim.type_idx and vim.val_idx instead of true and false

Do you mean vim.inspect()?

from neovim.

altermo avatar altermo commented on May 20, 2024

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.

from neovim.

bfredl avatar bfredl commented on May 20, 2024

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 keys true and false set to some numbers, which is confusing.

Hmm in this particular case it is a bug. There is no "compat" going on here but vim.api.nvim_win_get_config() is a native API call. And as the type of row/col is an hard-coded Float, not a free Object, it should always be represented by a lua number (i e row=2 and row=2.0 is the same value already in the API layer)

Special dicts for numbers are only for cases where 2 as an int and 2.0 as a float are different as values, i e when representing foreign type systems.

from neovim.

altermo avatar altermo commented on May 20, 2024

The behavior of vim.api.nvim_win_get_config() returning lua-special-tbl being a bug was already brought up, and marked as intended behavior (#24430 (comment))

from neovim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.