trouble.nvim icon indicating copy to clipboard operation
trouble.nvim copied to clipboard

bug: Error on exit due to autocmd BufEnter failing

Open keithroe opened this issue 1 year ago • 1 comments

Did you check docs and existing issues?

  • [X] I have read all the trouble.nvim docs
  • [X] I have searched the existing issues of trouble.nvim
  • [X] I have searched the exsiting issues of plugins related to this issue

Neovim version (nvim -v)

VIM v0.8.1 Build type: Release LuaJIT 2.1.0-beta3 Compiled by runner@fv-az178-366

Operating system/version

Linux x64

Describe the bug

When I have my nvim session split into two windows (one window editing code, other is trouble), if I quit while focus is on the editing window, I get the following error:

E5108: Error executing lua ...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:338: Vim:E444: Cannot close last window
stack traceback:
        [C]: in function 'nvim_win_close'
        ...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:338: in function 'on_enter'
        ...site/pack/packer/start/trouble.nvim/lua/trouble/init.lua:199: in function 'action'
        [string ":lua"]:1: in main chunk```

I have removed EVERYTHING from my nvim config that I can and still repro  My minimal trouble setup
* packer, 
* trouble (tried latest and 1.0.0 tag)
* todo-comments, plenery (just so that something will show up in trouble)
I have removed all other nvim config (other plugins, vim settings, keymappings, etc).  I only rquire my plugins file which I have stripped down to these plugins.  I do nothing in the setup functions for these plugins.


### Steps To Reproduce

1. Install the specified plugins.
2. open any source file with a TODO comment in it.
3. issue :TodoTrouble
4. Use trouble to navigate to the TODO comment
5. issue :q
6. see error message

### Expected Behavior

Quit out of window

### Repro

```Lua
-- ensure the packer plugin manager is installed
--------------------------------------------------------------------------------
local ensure_packer = function()
    local fn = vim.fn
    local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
    if fn.empty(fn.glob(install_path)) > 0 then
        fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
        vim.cmd([[packadd packer.nvim]])
        return true
    end
    return false
end

local packer_bootstrap = ensure_packer()


-- Specify plugins
--------------------------------------------------------------------------------
require("packer").startup(function(use)
    -- Packer can manage itself
    use("wbthomason/packer.nvim")
     use {
        -- Trouble for rust-analyzer display
        "folke/trouble.nvim",
	version = "1.0.0",
        requires = "kyazdani42/nvim-web-devicons",
    }

    use {
        "folke/todo-comments.nvim",
        requires = "nvim-lua/plenary.nvim",
    }
end)

-- the first run will install packer and our plugins
--------------------------------------------------------------------------------
if packer_bootstrap then
    require("packer").sync()
    return
end

require("trouble").setup {
}


-- todo-comments
--------------------------------------------------------------------------------
require("todo-comments").setup {
}

keithroe avatar Jan 23 '23 23:01 keithroe

This may be fixed with #291

jgoguen avatar Jun 03 '23 18:06 jgoguen

Development on the main branch is EOL.

Trouble has been rewritten and will be merged in main soon.

This issue/feature either no longer exists or has been implemented on dev.

For more info, see https://github.com/folke/trouble.nvim/tree/dev

folke avatar Mar 29 '24 07:03 folke