akinsho / akinsho/bufferline.nvim

[Bug]: GROUPS: filename/name not working

Abierto
#1,038 1 comentario 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Lua
Estrellas
4.4k
Forks
240
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.