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

"LanguageTree:for_each_child() is deprecated, use LanguageTree:children() instead." #1104

Closed
1 of 2 tasks
sekomidev opened this issue Oct 7, 2023 · 2 comments · Fixed by #1130
Closed
1 of 2 tasks
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.

Comments

@sekomidev
Copy link

sekomidev commented Oct 7, 2023

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

Neovim Version

NVIM v0.10.0-dev-5f4f83b

Neorg setup

{
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
dependencies = { "nvim-lua/plenary.nvim", { "laher/neorg-exec" } },
config = function()
require("neorg").setup({
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {
config = {
icons = {
todo = {
urgent = {
icon = "!",
},
},
},
},
}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
notes = "~/notes",
diary = "/mnt/crypt/diary",
},
default_workspace = "notes",
},
},
["core.ui.calendar"] = {
config = {
strategy = "nested",
},
},
["core.esupports.metagen"] = {
config = {
template = {
{
"title",
function()
return vim.fn.expand("%:t:r")
end,
},
{ "description", "" },
{
"authors",
function()
return vim.fn.getenv("USER")
end,
},
{ "categories", "" },
{
"created",
function()
return os.date("%Y-%m-%d %H:%M %z")
end,
},
{
"updated",
function()
return os.date("%Y-%m-%d %H:%M %z")
end,
},
},
},
},
["external.exec"] = {},
},
})
end,
},

Actual behavior

Upon saving a file with any metadata in it, these two warnings appear:

  • LanguageTree:for_each_child() is deprecated, use LanguageTree:children() instead. :help deprecated
    This feature will be removed in Nvim version 0.11
  • stack traceback:
    ...r/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:466: in function 'for_each_child'
    ...eorg/lua/neorg/modules/core/esupports/metagen/module.lua:248: in function 'update_metadata'
    ...eorg/lua/neorg/modules/core/esupports/metagen/module.lua:338: in function <...eorg/lua/neorg/modules/core/esupports/metagen/module.lua:337>

image

Since this is a deprecation warning, it doesn't seem to affect the functionality for now.

Expected behavior

I expected to see no such warnings.

Steps to reproduce

  • Create a new file with .norg extension
  • Run the following command in neovim: Neorg inject-metadata
  • Try to save the file

Potentially conflicting plugins

No response

Other information

It seems that these warnings only occur in the metagen module. While I do have a custom template, it shouldn't affect the presence of the warning in any way.

Not sure if this is really a bug, since the plugin still works, but I didn't see anyone mention this issue before.

Help

None

Implementation help

No response

@sekomidev sekomidev added the bug Issues related to bugs. Please attach a severity, a priority and category with this label. label Oct 7, 2023
@github-project-automation github-project-automation bot moved this to added-updated-reopened in sorting neorg issue tracker Oct 7, 2023
@max397574
Copy link
Contributor

this issue will occur to anyone using a relatively new neovim-nightly. There is no replacement function for this one which actually makes things easier because we don't have to check if a new function exists. There are some examples of how this function can be replaced in the pr which deprecated it. I just haven't found the time to do that yet.

benatouba added a commit to benatouba/neorg that referenced this issue Oct 27, 2023
Treesitters `for_each_child()` will be deprecated in 0.11.
It ias encouraged to use `children()` and implement the recursion
yourself.

We use a loop to iterate over the tree's children and call the
usual function for each child.

fixes nvim-neorg#1104
@github-project-automation github-project-automation bot moved this from added-updated-reopened to done in sorting neorg issue tracker Oct 29, 2023
@vhyrro
Copy link
Member

vhyrro commented Oct 29, 2023

This has since been fixed in the latest commit, check it out! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants