NTBBloodbath / doom-one.nvim

doom-emacs' doom-one Lua port for Neovim
MIT License
211 stars 32 forks source link

[Bug report] bad argument #2 to '?' (number expected, got nil) #32

Closed kohane27 closed 1 year ago

kohane27 commented 1 year ago

Hello there, hope you're doing well.

I updated today and got the following error:

Error detected while processing /home/user/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/user/.config/nvim/lua/core/colors.lua:36: Vim(colorscheme):
E5113: Error while calling lua chunk: ...te/pack/packer/start/doom-one.nvim/lua/doom-one/init.lua:
448: bad argument #2 to '?' (number expected, got nil)
stack traceback:
        [builtin#89]: at 0x7f4c2be4a4b0
        ...te/pack/packer/start/doom-one.nvim/lua/doom-one/init.lua:448: in function 'set_colorscheme'
        ...site/pack/packer/start/doom-one.nvim/colors/doom-one.lua:9: in main chunk
        [C]: in function 'cmd'
        /home/user/.config/nvim/lua/core/colors.lua:36: in main chunk
        [C]: in function 'require'
        /home/user/.config/nvim/init.lua:8: in main chunk
stack traceback:
        [C]: in function 'cmd'
        /home/user/.config/nvim/lua/core/colors.lua:36: in main chunk
        [C]: in function 'require'
        /home/user/.config/nvim/init.lua:8: in main chunk

The following is the color.lua (which I didn't change anything for a long time):

-- Add color to cursor
vim.g.doom_one_cursor_coloring = false
-- terminal colors
vim.g.doom_one_terminal_colors = false
-- Enable italic comments
vim.g.doom_one_italic_comments = false
-- Enable TS support
vim.g.doom_one_enable_treesitter = true
-- Color whole diagnostic text or only underline
vim.g.doom_one_diagnostics_text_color = false
-- Enable transparent background
vim.g.doom_one_transparent_background = false

-- Pumblend transparency
vim.g.doom_one_pumblend_enable = false
vim.g.doom_one_pumblend_transparency = 20

-- Plugins integration
vim.g.doom_one_plugin_nvim_tree = true
vim.g.doom_one_plugin_whichkey = true
vim.g.doom_one_plugin_indent_blankline = true
vim.g.doom_one_plugin_lspsaga = true
vim.g.doom_one_plugin_barbar = true
vim.g.doom_one_plugin_neorg = false
vim.g.doom_one_plugin_telescope = false
vim.g.doom_one_plugin_neogit = false
vim.g.doom_one_plugin_dashboard = false
vim.g.doom_one_plugin_startify = false
vim.g.doom_one_plugin_vim_illuminate = false

vim.cmd([[colorscheme doom-one]])
:version
NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

Any help is much appreciated. Thank you!

luisvgs commented 1 year ago

I also got this error after the update.

NTBBloodbath commented 1 year ago

Hey, hope you're doing well too!

This is very odd to me, line 448 shouldn't be sending an error to you as you're disabling neorg integration and that code chunk shouldn't be running in your Neovim instances.

If you're compiling Neovim from source can you please build using RelWithDebInfo instead of just Release? That build mode will be the same as Release but will include debugging information that is useful to debug Lua errors traceback so Lua isn't going to send that '?' nonsense thanks to a unknown debugging symbol in the error message as this isn't useful for us to get what's wrong.

bad argument #2 to '?' (number expected, got nil)

Cheers!

phush0 commented 1 year ago

Rebuild this morning from master and had same problem. But disabling neorg fixed it for me. Like something had changed in nightly builds.

well problem returned:

packer.nvim: Error running config for doom-one.nvim: [string "..."]:0: Vim(colorscheme):E5113: Error while calling lua chunk: ...site/pack/packer/opt/doom-one.nvim/lua/doom-one/init.lua:448: bad argument #2 to '?' (number expected, got nil)
stack traceback:
^I[builtin#89]: at 0x01054363d0
^I...site/pack/packer/opt/doom-one.nvim/lua/doom-one/init.lua:448: in function 'set_colorscheme'
^I...m/site/pack/packer/opt/doom-one.nvim/colors/doom-one.lua:9: in main chunk
^I[C]: in function 'cmd'
^I[string "..."]: in function <[string "..."]:0>
^I[C]: in function 'pcall'
^I/Users/phush0/.config/nvim/plugin/packer_compiled.lua:65: in function 'try_loadstring'
^I/Users/phush0/.config/nvim/plugin/packer_compiled.lua:276: in function </Users/phush0/.config/nvim/plugin/packer_compiled.lua:10>
^I[C]: in function 'pcall'
^I/Users/phush0/.config/nvim/plugin/packer_compiled.lua:10: in main chunk
NVIM v0.9.0-dev-1523+g5c5187c6f-dirty
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /opt/homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99
 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -DNVIM_MSGPA
CK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20221114-82717-usvi8c/build/cmake.config -I/tmp/neovim-20221114-82717-usvi8c/src -I/opt/homebrew/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include
 -I/opt/homebrew/opt/gettext/include -I/tmp/neovim-20221114-82717-usvi8c/build/src/nvim/auto -I/tmp/neovim-20221114-82717-usvi8c/build/include

I think this is some kind of bug, because just setting in plugin:

neorg = vim.g.doom_one_plugin_neorg or false,

fixed all for me. File is somehow unaligned and some definitions in neorg section are misaligned and if is always true. Other rows are with tabs just this section is with spaces - some kind of editing problem.

luisvgs commented 1 year ago

@phush0 this approach does not works for me :(

jdhao commented 1 year ago

Same error here on macOS with nvim stable release (0.8.0)

To reproduce, nvim -u init.vim, content of init.vim:

set runtimepath+=/Users/jdhao/.local/share/nvim/site/pack/packer/opt/doom-one.nvim
colorscheme doom-one
kohane27 commented 1 year ago
:version
NVIM v0.9.0-dev-314+ge8cc489ac
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wn
o-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-form
at-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=alwa
ys -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/
home/usr/bin/neovim/build/cmake.config -I/home/usr/bin/neovim/src -I/home/usr/bin/neovim/.deps/usr/include -I/usr/include -I
/home/usr/bin/neovim/build/src/nvim/auto -I/home/usr/bin/neovim/build/include
Compiled by usr@usr

Features: +acl +iconv +tui
Error detected while processing /home/usr/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/usr/.config/nvim/lua/core/colors.lua:36: Vim(colorscheme):E5113: Error while calling lua chunk: ...te/pack/packer/start/doom-one.nvim/lua/doom-one/init.lua:448: bad argument #2 to '?' (number expected, got nil)
stack traceback:
        [builtin#89]: at 0x5584a634b480
        ...te/pack/packer/start/doom-one.nvim/lua/doom-one/init.lua:448: in function 'set_colorscheme'
        ...site/pack/packer/start/doom-one.nvim/colors/doom-one.lua:9: in main chunk
        [C]: in function 'cmd'
        /home/usr/.config/nvim/lua/core/colors.lua:36: in main chunk
        [C]: in function 'require'
        /home/usr/.config/nvim/init.lua:8: in main chunk
stack traceback:
        [C]: in function 'cmd'
        /home/usr/.config/nvim/lua/core/colors.lua:36: in main chunk
        [C]: in function 'require'
        /home/usr/.config/nvim/init.lua:8: in main chunk

Hopefully it helps.

fitrh commented 1 year ago

This is due to the remaining TS* group

diff --git a/lua/doom-one/init.lua b/lua/doom-one/init.lua
index 9e6eec8..fa616a0 100644
--- a/lua/doom-one/init.lua
+++ b/lua/doom-one/init.lua
@@ -423,18 +423,18 @@ doom_one.set_colorscheme = function()
        set_hl("NeorgMarkupVerbatim", { link = "Comment" })

        -- Headers and their prefix icon
-       set_hl("NeorgHeading1Title", { link = "TSAttribute" })
-       set_hl("NeorgHeading2Title", { link = "TSLabel" })
-       set_hl("NeorgHeading3Title", { link = "TSMath" })
-       set_hl("NeorgHeading4Title", { link = "TSString" })
-       set_hl("NeorgHeading5Title", { link = "TSType" })
-       set_hl("NeorgHeading6Title", { link = "TSNumber" })
-       set_hl("NeorgHeading1Prefix", { link = "TSAttribute" })
-       set_hl("NeorgHeading2Prefix", { link = "TSLabel" })
-       set_hl("NeorgHeading3Prefix", { link = "TSMath" })
-       set_hl("NeorgHeading4Prefix", { link = "TSString" })
-       set_hl("NeorgHeading5Prefix", { link = "TSType" })
-       set_hl("NeorgHeading6Prefix", { link = "TSNumber" })
+       set_hl("NeorgHeading1Title", { link = "@attribute" })
+       set_hl("NeorgHeading2Title", { link = "@label" })
+       set_hl("NeorgHeading3Title", { link = "@math" })
+       set_hl("NeorgHeading4Title", { link = "@string" })
+       set_hl("NeorgHeading5Title", { link = "@type" })
+       set_hl("NeorgHeading6Title", { link = "@number" })
+       set_hl("NeorgHeading1Prefix", { link = "@attribute" })
+       set_hl("NeorgHeading2Prefix", { link = "@label" })
+       set_hl("NeorgHeading3Prefix", { link = "@math" })
+       set_hl("NeorgHeading4Prefix", { link = "@string" })
+       set_hl("NeorgHeading5Prefix", { link = "@type" })
+       set_hl("NeorgHeading6Prefix", { link = "@number" })

        -- Colors are for nested quotes
        set_hl("Blue", { fg = palette.blue })

However, this should not affect the users who disabled neorg plugin

line 448 shouldn't be sending an error to you as you're disabling neorg integration

@NTBBloodbath every vim.g.doom_one_* should be set to false by default (or a more reliable mechanism instead of using or) since doing false or true will always give us true

NTBBloodbath commented 1 year ago

Fixed in #33