Closed rktjmp closed 2 years ago
I'm getting an error:
E5113: Error while calling lua chunk: /Users/mcchris/Library/Preferences/nvim/plugin/colors.lua:22: Vim(lua):E5108: Error executing lua ...pport/nvim/site/pack/
packer/start/lush.nvim/lua/lush.lua:47: 'bg' is not a valid color
stack traceback:
[C]: in function 'nvim_set_hl'
...pport/nvim/site/pack/packer/start/lush.nvim/lua/lush.lua:47: in function 'apply'
...pport/nvim/site/pack/packer/start/lush.nvim/lua/lush.lua:66: in function <...pport/nvim/site/pack/packer/start/lush.nvim/lua/lush.lua:64>
...te/pack/packer/start/zenbones.nvim/lua/zenbones/util.lua:8: in function 'apply_colorscheme'
[string ":lua"]:1: in main chunk
I'm getting an error:
packer/start/lush.nvim/lua/lush.lua:47: 'bg' is not a valid color
https://github.com/mcchrish/zenbones.nvim/blob/e4def19944485787f5172bb952f8d46755999688/lua/zenbones/specs/dark.lua#L384 https://github.com/mcchrish/zenbones.nvim/blob/e4def19944485787f5172bb952f8d46755999688/lua/zenbones/specs/dark.lua#L365
NnnVertSplit { fg = "bg" },
NvimTreeVertSplit { fg = "bg" },
Probably these never worked before but hi Xxx fg=bg
was just not failing loudly?
I think it should be allowed.
:hi NnnVertSplit
NnnVertSplit xxx guifg=bg
:hi Ignore
Ignore xxx ctermfg=15 guifg=bg
Is it an upstream bug?
The error message comes from here:
https://github.com/neovim/neovim/blob/6d4180a0d20d0b730b6e64acdac39261f52a9277/src/nvim/highlight.c#L841-L848 -> https://github.com/neovim/neovim/blob/6d4180a0d20d0b730b6e64acdac39261f52a9277/src/nvim/highlight.c#L972 -> https://github.com/neovim/neovim/blob/6d4180a0d20d0b730b6e64acdac39261f52a9277/src/nvim/highlight_group.c#L2762-L2772
I think perhaps the groups are getting set before the Normal group which is why it probably appears "every other time". "bg" is valid, but sometimes normal_bg
is not set yet and so it returns -1.
Probably I will have to pick out the Normal group from the highlights and force that to apply first. I think Normal is the only special case.
It is debatable whether it's a bug upstream in that they're assuming Normal always exists, which is probably fair to assume, and only appears if someone happens to use the special color values "bg"/"fg". Probably more of a documentation omission than a bug.
Thanks for the thorough explanation and digging!
I just test again and it's now fixed.
So far, I don't see noticeable perf improvement, at least according to --startuptime
.
Merged but GH doesn't believe me. Release tagged as v2.0.0.
I am only using a compiler. them.vim is actually faster than them.lua. vim.api.nvim_set_hl
is slower than :highlight
in the compiled file.
How are you benching that? I don't see the same behaviour:
:luafile via-highlight.lua
651773
:luafile via-highlight.lua
757173
:luafile via-highlight.lua
657299
:lua via-set-hl.lua
287265
:lua via-set-hl.lua
313764
:lua via-set-hl.lua
294182
Seems to be ~2x faster in the sections we can control and benchmark. Unsure on the numbers outside of our code but we can't effect those. (i.e. perhaps nvim collates the highlight commands and pushes them through faster than the calls to set_hl.)
Sorry, you are right.
I have accumulated the vim.v.vim_did_enter
in Lua, which is so expensive.
The 1.1.0 release of Lush brings the following changes:
The minimum Neovim version is now 0.7.
Highlight groups are applied via
nvim_set_hl
Format modifiers can be set individually via
bold = true
if preferred.bold
,italic
,underline
,underunderline
,undercurl
,underdot
,underdash
,strikethrough
,reverse
,standout
,nocombine
.gui
, individual format modifiers will override any rule set viagui
in the same group.gui
on a group will disable any non-set format modifiers.gui
or individual modifiers, for consistency.Shipwright lua exporter now only exports
Group = {fg = ...},
strings to be inserted in a lua table form.nvim_set_hl
removes a lot of complexity needed to convert structured colorscheme data into applicable highlights.The following features have been removed:
lush.stringify
andlush.export_to_buffer
lush.compile
no longer supports plugins and always returns a table of group and attribute pairs.