nvim-neo-tree / neo-tree.nvim

Neovim plugin to manage the file system and other tree like structures.
MIT License
3.83k stars 225 forks source link

BUG: Error when switching from telescope to floating neo-tree #1291

Open Rizhiy opened 10 months ago

Rizhiy commented 10 months ago

Did you check docs and existing issues?

Neovim Version (nvim -v)

v0.9.4

Operating System / Version

Linux starling 6.2.0-39-generic #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Describe the Bug

When trying to switch from Telescope to neo-tree with floating window it fails and gives the following error:

[Neo-tree ERROR] debounce  filesystem_navigate  error:  ...are/nvim/lazy/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:903: Failed to switch to window 1033

i.e. when telescope window is open, try to open neo-tree floating window. Works fine if window is not floating.

Screenshots, Traceback

No response

Steps to Reproduce

  1. Install neo-tree, set window.position = float
  2. Install telescope
  3. Open telescope window (e.g. space-f)
  4. Press ESC to exit input mode
  5. Try to open neo-tree (e.g. space-e)

Expected Behavior

Switches to neo-tree without error

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 = {
        {
            "<space>e",
            function()
                require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() })
            end,
            desc = "File Explorer",
        },
    },
    opts = {
        window = {
            position = "float",
        },
    },
}

table.insert(plugins, neotree_config)

local telescope_config = {
    "nvim-telescope/telescope.nvim",
    lazy = false,
    tag = "0.1.5",
    dependencies = {
        "nvim-lua/plenary.nvim",
    },
    keys = {
        { "<space>f", ":Telescope live_grep<CR>", desc = "Exact search" },
    },
}
table.insert(plugins, telescope_config)
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
josefeer commented 6 months ago

I'm able to reproduce this bug.

Also when neo-tree is used in https://github.com/folke/edgy.nvim

I get a similar error when toggling for second time edgy in neovim.