nvim-tree / nvim-tree.lua

A file explorer tree for neovim written in lua
Other
7.28k stars 608 forks source link

[Bug] 'E158: Invalid buffer name' when using diagnostics and opening second file #501

Closed Iron-E closed 3 years ago

Iron-E commented 3 years ago

Thank you for this plugin! I have really enjoyed being able to slowly replace all of my old VimL plugins with Lua ones.

I noticed that whenever a language server is attached (I use the builtin vim.lsp), and the g:nvim_tree_lsp_diagnostics option is enabled, any time I enter a file it will trigger issues with the buffer. Here is a minimal repro:

let g:nvim_tree_lsp_diagnostics = v:true

packadd nvim-lspconfig
packadd nvim-tree.lua

-- any language server will do, rust_analyzer just an example
lua require('lspconfig').rust_analyzer.setup {}

I then:

  1. Run nvim -u <file>
  2. Execute :NvimTreeToggle
  3. Navigate to any file which an LSP will attach to
  4. Run :NvimTreeToggle again
  5. Open another file.

Possibly related: #366. I have similar issues when running :Neogit outside of a Git directory.

https://user-images.githubusercontent.com/36409591/125145347-d7a9cd80-e0ee-11eb-9c2e-f8244ec276f8.mp4

kyazdani42 commented 3 years ago

44678adc1e6ab should have fixed your neogit issue. Haven't seen this other one though

Iron-E commented 3 years ago

I've found you can get the errors to stop if you can manage to open the tree back up and manually q it. Haven't looked much at the code but is the tree hidden on file open rather than closed?

kyazdani42 commented 3 years ago

@Iron-E sorry for the late answer. Indeed the tree is hidden never closed.

Iron-E commented 3 years ago

I can't reproduce this issue anymore. Some change along the way must have fixed it!

Antonio-Bennett commented 2 years ago

@kyazdani42 Hey I am running into this issue. image

@Iron-E Have you encountered this again?

kyazdani42 commented 2 years ago

pushed a fix for this issue in latest master.

Antonio-Bennett commented 2 years ago

@kyazdani42 You absolute legend!!! Thanks a lot