akinsho / akinsho/bufferline.nvim

[Bug]: GROUPS: filename/name not working

Aperta
#1,038 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Lua
Stelle
4.4k
Fork
240
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

I pasted the sample code from the readme:
```lua
groups = {
options = {
toggle_hidden_on_enter = true -- when you re-enter a hidden group this options re-opens that group so the buffer is visible
},
items = {
{
name = "Tests", -- Mandatory
highlight = {underline = true, sp = "blue"}, -- Optional
priority = 2, -- determines where it will appear relative to other groups (Optional)
icon = " ", -- Optional
matcher = function(buf) -- Mandatory
return buf.filename:match('%_test') or buf.filename:match('%_spec')
end,
},
{
name = "Docs",
highlight = {undercurl = true, sp = "green"},
auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
matcher = function(buf)
return buf.filename:match('%.md') or buf.filename:match('%.txt')
end,
separator = { -- Optional
style = require('bufferline.groups').separator.tab
},
}
}
}

```

got this error:
```
 Error 19:46:07 msg_show.lua_error E5108: Error executing lua ...sers/Henri/AppData/Local/nvim/lua/plugins/bufferline.lua:19: attempt to index field 'filename' (a nil value)
stack traceback:
...sers/Henri/AppData/Local/nvim/lua/plugins/bufferline.lua:19: in function 'matcher'
...nvim-data/lazy/bufferline.nvim/lua/bufferline/groups.lua:197: in function 'set_id'
...vim-data/lazy/bufferline.nvim/lua/bufferline/buffers.lua:74: in function 'get_components'
.../Local/nvim-data/lazy/bufferline.nvim/lua/bufferline.lua:56: in function <.../Local/nvim-data/lazy/bufferline.nvim/lua/bufferline.lua:54>

```

i tested a bit more and it seems like the field "filename" is completly missing

i found the field "name", and it seemed like this is the actuall "filename" but you get an error when indexing (a nil value) but its get listed when: vim.print(buf)

### What did you expect to happen?

Expected behaviour

### Config

---

### Additional Information

...

### commit

_No response_

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.