Closed nyngwang closed 1 year ago
also got this error, also using default settings.
neovim 0.9.1 (homebrew)
macOS 13.4 (M1)
Neovide 0.10.4 (homebrew)
Do you have Treesitter installed for the filetype you're opening?
https://github.com/HampusHauffman/block.nvim/commit/6c5b0e13fdfe7ae0b97accb52274066e8ccb7a88 Curious if this was the issue. If you could please try it again after updating. Mind you calling Block on files types that are not supported or not installed with treesitter wont work (but shouldnt throw an error)
using on lua files, where I also have the treesitter parser installed
still getting the very same error with the update
Running into the same issue.
This is not a treesitter problem or related to that commit, as the error says there is no table.unpack
on your systems. table.unpack and table.pack
were added in lua 5.2 moving it from builtin functions to inside the table
metatable. luajit is based on lua 5.1, with some 5.2 additions backported. If luajit is compiled with LUAJIT_ENABLE_LUA52COMPAT it enables a few more 5.2 features, among which is table.unpack
and table.pack
in addition to the builtins unpack, pack
. It seems some people have it (author) and some don't
Anyway just use unpack, pack
Thank you!
Changing table.unpack
to unpack
worked.
https://github.com/HampusHauffman/block.nvim/commit/93b8163bca9f39d95362b1a968a6a5a5f3a6d492 Yes thank you @IndianBoy42!
nice, thanks @IndianBoy42.
btw @HampusHauffman, you can catch this type of problem early on by telling the lua-lsp to use LuaJIT
.
create a file named .luarc.json
with the following content and put it into the root folder of your plugin.
{
"runtime.version": "LuaJIT"
}
Then, using lua code not valid in LuaJIT like table.unpack
should result in a diagnostic message by the lua LSP:
While the error disappeared, it doesn't show me the highlight after calling :BlockOn
.
@nyngwang Hard to troubleshoot if just nothing happens :/
@HampusHauffman I just found a clue that if I call the setup
the second time manually after the Lua LSP has been loaded then calling :Block
again will show the coloring.
@nyngwang Could you show me the setup you have in your plugin manager?
Yes, I'm using the same one:
update: I realized that it has nothing to do with Lua LSP.
use {
'HampusHauffman/block.nvim',
config = function ()
require('block').setup {
percent = 0.8, -- e.g. 0.8 would change each box to be 20% darker than the last and 1.2 would be 20% brighter.
depth = 4, -- after this the colors reset.
automatic = false,
}
end
}
@nyngwang Does that mean you solved it?
No. I'm still finding the reason why I need to call the setup
again to ensure that :BlockOn
will take effect after entering Neovim. But I found that I don't have to wait for the Lua LSP to finish before calling setup
.
@HampusHauffman My bad, I should create a new issue, since the title of this issue had been resolved. Let me close this and tag you there.