Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求助 ,.cker/start/catppuccin/lua/catppuccin/lib/highlighter.lua:11: bad argument #1 to 'ipairs' (table expected, got string) #199

Closed
corbettbain opened this issue Aug 20, 2022 · 4 comments

Comments

@corbettbain
Copy link

corbettbain commented Aug 20, 2022

NVIM v0.8.0-dev-877-g35653e6bc
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -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 -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/corbettbain/myfiles/dev/projects/github/open-source/neovim/build/cmake.config -I/home/corbettbain/myfiles/dev/projects/github/open-source/neovim/src -I/home/corbettbain/myfiles/dev/projects/github/open-source/neovim/.deps/usr/include -I/usr/include -I/home/corbettbain/myfiles/dev/projects/github/open-source/neovim/build/src/nvim/auto -I/home/corbettbain/myfiles/dev/projects/github/open-source/neovim/build/include
Compiled by corbettbain@JingOS

Features: +acl +iconv +tui
See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/share/nvim"

使用分支为coc

打开init.lua报错信息:

Error detected while processing /home/corbettbain/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/corbettbain/.config/nvim/lua/core/init.lua:168: Vim(colorscheme):E5113: Error while calling lua chunk
: ...cker/start/catppuccin/lua/catppuccin/lib/highlighter.lua:11: bad argument #1 to 'ipairs' (table expected, got string)
stack traceback:
[C]: in function 'ipairs'
...cker/start/catppuccin/lua/catppuccin/lib/highlighter.lua:11: in function 'highlight'
...cker/start/catppuccin/lua/catppuccin/lib/highlighter.lua:22: in function 'syntax'
...cker/start/catppuccin/lua/catppuccin/lib/highlighter.lua:40: in function 'load'
...ite/pack/packer/start/catppuccin/lua/catppuccin/init.lua:27: in function 'load'
.../site/pack/packer/start/catppuccin/colors/catppuccin.lua:1: in main chunk
[C]: in function 'cmd'
/home/corbettbain/.config/nvim/lua/core/init.lua:168: in function 'load_core'
/home/corbettbain/.config/nvim/lua/core/init.lua:171: in main chunk
[C]: in function 'require'
/home/corbettbain/.config/nvim/init.lua:2: in main chunk
stack traceback:
[C]: in function 'cmd'
/home/corbettbain/.config/nvim/lua/core/init.lua:168: in function 'load_core'
/home/corbettbain/.config/nvim/lua/core/init.lua:171: in main chunk
[C]: in function 'require'
/home/corbettbain/.config/nvim/init.lua:2: in main chunk

@Jint-lzxy
Copy link
Collaborator

使用分支为coc

This is because the coc branch isn't updated in time.

bad argument 1 to 'ipairs' (table expected, got string)

The reason behind this is catppuccin v0.2 requires the usr to use lua table to pass in settings, just a quick glance at https://github.com/catppuccin/nvim#configuration or directly copy the configuration on main branch or see this PR would be helpful. In addition, it is strongly recommended to read through the Wiki to learn how to configure catppuccin 👍

I personally wouldn't recommend using the coc branch. The native lsp of neovim (using main branch) is enough to provide similar experience while ensuring a good performance.


使用分支为coc

这是因为coc分支没有及时更新导致的。

bad argument 1 to 'ipairs' (table expected, got string)

背后的原因则是catppuccin V0.2需要使用lua表传入参数。参考 https://github.com/catppuccin/nvim#configuration 或者 直接复制 main分支的设置 或者 参考 这个PR 都可以解决这个问题。另外,强烈建议看一下Wiki了解如何配置catppuccin 👍

个人不建议使用coc分支,neovim的原生lsp(使用main分支)已经足以能在保证性能的情况下同时提供类似的体验了。

@Jint-lzxy
Copy link
Collaborator

可以参考下面的pattern更改设置~

  • style = "italic" -> style = { "italic" }
  • "bold,italic" -> { "bold", "italic" }
  • "NONE" -> {}

@corbettbain
Copy link
Author

感谢 , 权衡下 还是 main分支更香。coc分支的coc.vim运行貌似还有问题,不想折腾了

@ayamir
Copy link
Owner

ayamir commented Aug 20, 2022

我已经删除了coc分支,因为已经好久没用过了,此外nvim-lsp的相关插件与工具链已经成熟,持续维护coc分支意义不大。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants