kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.18k stars 38 forks source link

Fix UfoFoldVirtTextHandler type annotations #95

Closed anuvyklack closed 1 year ago

anuvyklack commented 1 year ago

fix type commits have descriptions.

kevinhwang91 commented 1 year ago

Thanks! I don't know ---@field [1] will work. Would you share the reference? Look like I need to improve my emmylua knowledge.

anuvyklack commented 1 year ago

It is not EmmyLua, it is just Lua itself.

The list

local list = { 'one', 'twe', 'three' }

is actually a table:

local list = {
   [1] = 'one',
   [2] = 'two',
   [3] = 'three'
}

So [1], [2] and [3] are real keys of the table, and you can specify them in an annotation.

kevinhwang91 commented 1 year ago

Cool, not aware of the Lua table is everything.