neo-tree.nvim icon indicating copy to clipboard operation
neo-tree.nvim copied to clipboard

BUG: Extra elements after fuzzy searching in document_symbols view - clicking them causes exception

Open porridgewithraisins opened this issue 1 year ago • 0 comments

Did you check docs and existing issues?

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

Neovim Version (nvim -v)

v0.10.2

Operating System / Version

Linux 6.11.3-arch1-1

Describe the Bug

I opened document_symbols view, and then fuzzy searched for something.

Few symbols were present more than once. Notably, they also rendered weirdly.

Screenshots, Traceback

image Check the bottom of the list, those symbols already appear above, and they also render weirdly. Clicking them causes an exception:

E5108: Error executing lua: ....nvim/lua/neo-tree/sources/document_symbols/commands.lua:21: attempt to index local 'node' (a nil value)                          
stack traceback:                                                                                                                                                 
        ....nvim/lua/neo-tree/sources/document_symbols/commands.lua:21: in function <....nvim/lua/neo-tree/sources/document_symbols/commands.lua:19> 

Steps to Reproduce

  1. Open document_symbols view
  2. Use fuzzy search on a nested symbol and land on the expanded view
  3. You should extraneous elements at the bottom.

Expected Behavior

The items dont appear.

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 = {
    {
    close_if_last_window = true,
    window = { width = 30 },
    filesystem = {
        follow_current_file = { enabled = true, leave_dirs_open = true },
        use_libuv_file_watcher = true,
    },
    sources = { "filesystem", "buffers", "git_status", "document_symbols" },
    source_selector = {
        winbar = true,
            sources = {
              { source = "filesystem" },
              { source = "buffers" },
              { source = "git_status" },
              { source = "document_symbols" },
            },
    }
}
  },
}

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

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

porridgewithraisins avatar Oct 14 '24 06:10 porridgewithraisins