EL-MASTOR / bufferlist.nvim

The fastest, most lightweight, minimal, extensible and super easy buffer manager for neovim
37 stars 1 forks source link

Bufferlist doesn't open after opening it a couple of times, opening more buffers, jumping around, ... #3

Closed loissascha closed 1 week ago

loissascha commented 1 week ago

After opening a couple of buffers (with neo-tree in case this matters) and using bufferlist a couple of times, jumping around between buffers and opening new buffers, I pretty quickly reach a point where I keep getting this erorr message whenever I try to open it: image

I'm not able to reproduce it reliably. Sometimes it happens after opening 2 buffers and using bufferlist like 3 times, sometimes after opening 5 buffers and using it 7 times. But it happens pretty quickly.

aldarg commented 1 week ago

Same error here, but I wasn't able open the buffer list even a single time. Tried to use it in rust project full of errors and warnings.

loissascha commented 1 week ago

@aldarg did you change the keybinds? Because if you did you gotta change both of them to the same one, otherwise it won't show up image

aldarg commented 1 week ago

No, just copied LazyVim setup from README: image

I'm no expert in lua, but callstack in error stops at iterating through diagnostics. So it seems that keybind is working. I mean it calls the plugin functions.

EL-MASTOR commented 1 week ago

After opening a couple of buffers (with neo-tree in case this matters) and using bufferlist a couple of times, jumping around between buffers and opening new buffers, I pretty quickly reach a point where I keep getting this erorr message whenever I try to open it: image

I'm not able to reproduce it reliably. Sometimes it happens after opening 2 buffers and using bufferlist like 3 times, sometimes after opening 5 buffers and using it 7 times. But it happens pretty quickly.

I think the error is caused by attempting to index the value returned by sign_getdefined. Could you please run those lines and share their results :

:lua =vim.fn.sign_getdefined('DiagnosticSignError') :lua =vim.fn.sign_getdefined('DiagnosticSignWarn') :lua =vim.fn.sign_getdefined('DiagnosticSignInfo') :lua =vim.fn.sign_getdefined('DiagnosticSignHint')

They should output something like this: { { name = "DiagnosticSignError", text = " ", texthl = "DiagnosticSignError" } }

aldarg commented 1 week ago

Ok, I did some debugging on file with some warnings and errors. vim.diagnostic.count(0) shows:

{
  [2] = 4,
  [4] = 4
}

So, 4 warnings and 4 hints. It's true :)

But when I use :sign list (alternative to sign_getdefined) I see all other kinds of signs:

sign precognition_gutter_gg text=gg texthl=PrecognitionHighlight
sign todo-sign-NOTE text=  texthl=TodoSignNOTE
sign todo-sign-HACK text=  texthl=TodoSignHACK
sign todo-sign-PERF text=  texthl=TodoSignPERF
sign todo-sign-TODO text=  texthl=TodoSignTODO
sign todo-sign-WARN text=  texthl=TodoSignWARN
sign todo-sign-FIX text=  texthl=TodoSignFIX
sign todo-sign-TEST text=⏲  texthl=TodoSignTEST
sign precognition_gutter_PrevParagraph text={  texthl=PrecognitionHighlight
sign precognition_gutter_NextParagraph text=}  texthl=PrecognitionHighlight
sign precognition_gutter_G text=G  texthl=PrecognitionHighlight
sign neotest_running text=  texthl=NeotestRunning
sign neotest_passed text=  texthl=NeotestPassed
sign neotest_skipped text=  texthl=NeotestSkipped
sign neotest_failed text=  texthl=NeotestFailed

When the code tries to filter this list by "DiagnosticSignWarn" key, it gets an empty list, then takes first element, which results in null. Again, I'm no expert in lua. Actually, I've never ever touched it. But from what I see this is the reason of error.

EL-MASTOR commented 1 week ago

After opening a couple of buffers (with neo-tree in case this matters) and using bufferlist a couple of times, jumping around between buffers and opening new buffers, I pretty quickly reach a point where I keep getting this erorr message whenever I try to open it: image

I'm not able to reproduce it reliably. Sometimes it happens after opening 2 buffers and using bufferlist like 3 times, sometimes after opening 5 buffers and using it 7 times. But it happens pretty quickly.

I updated the diagnostics function so that it shows the icons defined by the user if they have, otherwise it falls back to the hard coded icons. It should be fixed now, please update and try again. If you get more errors feel free to report them.