NvChad / ui

Lightweight & high performance UI plugin for nvchad
GNU General Public License v3.0
206 stars 124 forks source link

Incorrect Lua type of the `modules` field of tabufline/statusline config table #287

Closed fishBone000 closed 2 months ago

fishBone000 commented 4 months ago

https://github.com/NvChad/ui/blob/b23a4dea45107305513e3c407179199cc2f1945e/nvchad_types/chadrc.lua#L98 is inconsistent with https://github.com/NvChad/ui/blob/b23a4dea45107305513e3c407179199cc2f1945e/lua/nvchad/stl/utils.lua#L28-L35

siduck commented 4 months ago

whats incorrect here? :thinking:

fishBone000 commented 4 months ago

Eh, like, the module can be a string:

    statusline = {
        modules = {
            cursor = "%#St_pos_sep#" .. "" .. "%#St_pos_icon# %#St_pos_text# %l,%v %p %% "
        }
    }

but ---@field modules? table<string, fun(): string> says it must be a func that returns a string

siduck commented 4 months ago

ohh, idk about lua types, @lucario387 and @KorigamiK and @mgastonportillo have contributed to it :smiley:

lucario387 commented 4 months ago

well, before it was only allowed to be a func :)

Things changed, but the types were not updated

mgastonportillo commented 4 months ago

I can push an update if that's fine. I noticed the script got updated as well.

Edit: wait, what's wrong with the type definition? It says modules can be either strings or functions that return a string, and that's correct

Edit2: found the issue

mgastonportillo commented 4 months ago

@lucario387 can you confirm if the script could have added types from some user's chadrc? I updated it as a chore before sending the PR and I see some types removed, but they seem to be external, like NeogitDiffDeleteHighlight

KorigamiK commented 4 months ago

@lucario387 can you confirm if the script could have added types from some user's chadrc? I updated it as a chore before sending the PR and I see some types removed, but they seem to be external, like NeogitDiffDeleteHighlight

Yeah these might be plugin highlights that get loaded after. It's probably best to not maintain them as a chore every time.

mgastonportillo commented 4 months ago

I'll look at it today and see where the tables merge. Maybe I can update the script first. I just need a confirmation to see if this behaviour is intended.

fishBone000 commented 4 months ago

By the way, I found this is incorrect too: https://github.com/NvChad/ui/blob/0c283b6aed4eed585a497c9031b18b5009bfe4dd/nvchad_types/chadrc.lua#L86 Since it can be table too: https://github.com/NvChad/ui/blob/0c283b6aed4eed585a497c9031b18b5009bfe4dd/lua/nvchad/stl/default.lua#L12

So perhaps there's some more lines to be changed in https://github.com/NvChad/ui/blob/0c283b6aed4eed585a497c9031b18b5009bfe4dd/nvchad_types/chadrc.lua

siduck commented 2 months ago

image

the error's fixed in recent commits i believe