Skip to content

BUG: Stack overflow when cutting and pasting a file with 'hide_root_node = true'. #1517

Open
@ghost

Description

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

NVIM v0.10.0

Operating System / Version

Arch linux 6.9.7-arch1-1

Describe the Bug

I was surprised when happened. The good thing is that i'm able to consistently reproduce it.

Screenshots, Traceback

image

[neo-tree] Could not open log file: /tmp/randomdir/.repro//data/nvim/neo-tree.nvim.log                                                                                                                                                          
Error executing vim.schedule lua callback: stack overflow                                                                                                                                                                                       
stack traceback:                                                                                                                                                                                                                                
        [C]: in function '__index'                                                                                                                                                                                                              
        ...domdir/.repro/plugins/neo-tree.nvim/lua/neo-tree/log.lua:138: in function 'warn'                                                                                                                                                     
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:364: in function 'render_component'                                                                                                                                         
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:434: in function 'prepare_node'                                                                                                                                             
        .../randomdir/.repro/plugins/nui.nvim/lua/nui/tree/init.lua:402: in function 'prepare'                                                                                                                                                  
        .../randomdir/.repro/plugins/nui.nvim/lua/nui/tree/init.lua:432: in function 'prepare'                                                                                                                                                  
        .../randomdir/.repro/plugins/nui.nvim/lua/nui/tree/init.lua:439: in function '_prepare_content'                                                                                                                                         
        .../randomdir/.repro/plugins/nui.nvim/lua/nui/tree/init.lua:453: in function 'render'                                                                                                                                                   
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:1157: in function 'render_tree'                                                                                                                                             
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:639: in function 'expand_to_node'                                                                                                                                           
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:505: in function 'focus_node'                                                                                                                                               
        ...                                                                                                                                                                                                                                     
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:682: in function 'restore'                                                                                                                                                  
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:1162: in function 'render_tree'                                                                                                                                             
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:639: in function 'expand_to_node'                                                                                                                                           
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:505: in function 'focus_node'                                                                                                                                               
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:682: in function 'restore'                                                                                                                                                  
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:1162: in function 'render_tree'                                                                                                                                             
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:1216: in function 'draw'                                                                                                                                                    
        ...repro/plugins/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:1330: in function 'show_nodes'                                                                                                                                              
        ...ree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua:96: in function 'render_context'                                                                                                                                            
        ...ree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua:165: in function <...ree.nvim/lua/neo-tree/sources/filesystem/lib/fs_scan.lua:164>                                                                                          
Press ENTER or type command to continue

Steps to Reproduce

  1. Go to /tmp/randomdir, create a directory named 'test' and a file called 'testfile'.
  2. Open neovim with nvim --clean -u repro.lua with the configuration from this issue.
  3. Open neotree with e, cut 'testfile' and paste it into 'test'
  4. Open 'test', cut 'testfile' again, paste it back into the parent directory (/tmp/randomdir).
  5. Neo tree shows a stack overflow error along with several other errors.

Expected Behavior

No errors, just the file correctly pasted.

Your Configuration

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
    "folke/tokyonight.nvim",
    -- add any other plugins here
}

local neotree_config = {
    "nvim-neo-tree/neo-tree.nvim",
    dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
    cmd = { "Neotree" },
    keys = {
        { "<Leader>e", "<Cmd>Neotree<CR>" }, -- change or remove this line if relevant.
    },
    opts = {
        hide_root_node = true,
    },
}

table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions