Skip to content

Error while running :NvimTreeCollapseKeepBuffers #1740

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

Closed
alfa07 opened this issue Nov 10, 2022 · 1 comment · Fixed by #1741
Closed

Error while running :NvimTreeCollapseKeepBuffers #1740

alfa07 opened this issue Nov 10, 2022 · 1 comment · Fixed by #1741
Labels
bug Something isn't working reproduced Issue confirmed

Comments

@alfa07
Copy link
Contributor

alfa07 commented Nov 10, 2022

Description

I am getting error below while trying execute: NvimTreeCollapseKeepBuffers

Error executing Lua callback: ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:272: attempt to get length of local 'nodes' (a nil value)
stack traceback:
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:272: in function '_get_nodes_number'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:285: in function 'build'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:265: in function '_build_line'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:289: in function 'build'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:265: in function '_build_line'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:289: in function 'build'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:265: in function '_build_line'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:289: in function 'build'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:265: in function '_build_line'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:289: in function 'build'
        ...cker/start/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:78: in function 'draw'
        ...ua/lua/nvim-tree/actions/tree-modifiers/collapse-all.lua:41: in function 'fn'
        ...m/site/pack/packer/start/nvim-tree.lua/lua/nvim-tree.lua:320: in function <...m/site/pack/packer/start/nvim-tree.lua/lua/nvim-tree.lua:319>
Press ENTER or type command to continue

Neovim version

❯ nvim --version
NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.8.0/share/nvim"

Run :checkhealth for more info

Operating system and version

macOS 12.6 Monterey

nvim-tree version

fb8735e

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup {
    {
      "wbthomason/packer.nvim",
      "nvim-tree/nvim-tree.lua",
      "nvim-tree/nvim-web-devicons",
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
    },
  }
end

if vim.fn.isdirectory(install_path) == 0 then
  print "Installing nvim-tree and dependencies."
  vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
  require("nvim-tree").setup {}
end

Steps to reproduce

  1. nvim -nu ~/dev/nvt-min.lua
  2. NvimTreeOpen
  3. Open any file in a tree
  4. NvimTreeCollapseKeepBuffers

Expected behavior

Only open buffers are show in the tree

Actual behavior

Error:

Error executing Lua callback: ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:272: attempt to get length of local 'nodes' (a nil value)
stack traceback:
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:272: in function '_get_nodes_number'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:285: in function 'build'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:265: in function '_build_line'
        ...r/start/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua:289: in function 'build'
        ...cker/start/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:76: in function 'draw'
        ...ua/lua/nvim-tree/actions/tree-modifiers/collapse-all.lua:41: in function 'fn'
        ...n/site/pack/packer/start/nvim-tree.lua/lua/nvim-tree.lua:318: in function <...n/site/pack/packer/start/nvim-tree.lua/lua/nvim-tree.lua:317>
Press ENTER or type command to continue
@alfa07 alfa07 added the bug Something isn't working label Nov 10, 2022
@gegoune gegoune added the reproduced Issue confirmed label Nov 11, 2022
@alex-courtis
Copy link
Member

Directory also becomes "corrupted" and cannot be opened, similar to #1723 although causes are different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproduced Issue confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants