akinsho / akinsho/bufferline.nvim

[Bug]: GROUPS: filename/name not working

Ouverte
#1,038 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
Lua
Étoiles
4.4k
Forks
240
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### 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_

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.