akinsho / akinsho/bufferline.nvim

[Bug]: GROUPS: filename/name not working

Đang mở
#1,038 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Lua
Star
4.4k
Fork
240
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.