HiPhish / rainbow-delimiters.nvim

Rainbow delimiters for Neovim with Tree-sitter
https://gitlab.com/HiPhish/rainbow-delimiters.nvim
Apache License 2.0
470 stars 35 forks source link

[Bug]: for_each_child deprecated #36

Closed phush0 closed 9 months ago

phush0 commented 10 months ago

Neovim version

0.11

Language affected

All

Query

No response

Strategy

No response

Description

as for latest main change for 0.11 nvim version `for_each_child` is deprecated

LanguageTree:for_each_child() is deprecated, use LanguageTree:children() instead. :help deprecated
This feature will be removed in Nvim version 0.11
stack traceback:
        ...c/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:461: in function 'for_each_child'
        ...limiters.nvim/lua/rainbow-delimiters/strategy/global.lua:118: in function 'setup_parser'
        ...limiters.nvim/lua/rainbow-delimiters/strategy/global.lua:163: in function <...limiters.nvim/lua/rainbow-delimiters/strategy/global.lua:160>
        [C]: in function 'pcall'
        ...y/rainbow-delimiters.nvim/lua/rainbow-delimiters/lib.lua:195: in function 'attach'
        ...zy/rainbow-delimiters.nvim/plugin/rainbow-delimiters.lua:63: in function <...zy/rainbow-delimiters.nvim/plugin/rainbow-delimiters.lua:59>
        [C]: in function 'nvim_cmd'
        ...llar/neovim/HEAD-9fc321c/share/nvim/runtime/filetype.lua:31: in function <...llar/neovim/HEAD-9fc321c/share/nvim/runtime/filetype.lua:30>
        [C]: in function 'nvim_buf_call'
        ...llar/neovim/HEAD-9fc321c/share/nvim/runtime/filetype.lua:30: in function <...llar/neovim/HEAD-9fc321c/share/nvim/runtime/filetype.lua:10>
llllvvuu commented 10 months ago

Sorry, I deprecated it, I also made a PR to add a utility to Neovim that'll make it easy to migrate: https://github.com/neovim/neovim/pull/25154

If/when that gets merged I'll make a PR to migrate rainbow-delimiters.nvim

HiPhish commented 10 months ago

When did LanguageTree:children get added?

llllvvuu commented 10 months ago

When did LanguageTree:children get added?

It was there from the beginning (when LanguageTree got added in 2020)

HiPhish commented 10 months ago

I have thrown together a small replacement function to patch us over until a proper replacement comes to Neovim. I will daily drive it for a few days before I commit to the repo.

JelteF commented 9 months ago

I have thrown together a small replacement function to patch us over until a proper replacement comes to Neovim. I will daily drive it for a few days before I commit to the repo.

I ran into this as well. Is the fix ready to share yet? The deprecation warning every time I open a file is quite annoying.

lostl1ght commented 9 months ago

Anyone who's using https://github.com/folke/noice.nvim can use this routing rule to hide the warning as a temporary solution:

{
  filter = {
    event = 'notify',
    kind = 'warn',
    find = 'for_each_child',
  },
  opts = { skip = true },
},
basheewang commented 9 months ago

I am trying to change "parser:for_each_child" to "parser:children" in line 118 of global.lua, and no warning pop out.

HiPhish commented 9 months ago

Sorry that it has taken longer than expected, I had computer problems. You can use the use-children branch until the change is merged to master for the time being.

HiPhish commented 9 months ago

The change is now on master, please report back if there are any issues.