akinsho / akinsho/bufferline.nvim

[Bug]: Incorrect length of underline when display lsp diagnostics indicator

未关闭
#970 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Lua
星标
4.4k
派生
240
PR 合并指标
30 天内没有已合并 PR

描述

### Is there an existing issue for this?

- [X] I have searched the existing issues

### What happened?

When showing diagnostics indicator after lsp have been prepared, the underline is split, length is too small.

![图片](https://github.com/user-attachments/assets/bb7d6d3b-4d89-41f5-9473-7eb8547262cf)

### What did you expect to happen?

The underline fill all length of the tab/buffer.

### Config

```lua
{
'akinsho/bufferline.nvim',
event = 'VeryLazy',
keys = {
{ 'bp', 'BufferLineTogglePin', desc = 'Toggle Pin' },
{ 'bP', 'BufferLineGroupClose ungrouped', desc = 'Delete Non-Pinned Buffers' },
{ 'bo', 'BufferLineCloseOthers', desc = 'Delete Other Buffers' },
{ 'br', 'BufferLineCloseRight', desc = 'Delete Buffers to the Right' },
{ 'bl', 'BufferLineCloseLeft', desc = 'Delete Buffers to the Left' },
{
'bq',
function()
MiniBufremove.delete()
end,
desc = '[Q]uit current [B]uffer',
},
{ '', 'BufferLineCyclePrev', desc = 'Prev Buffer' },
{ '', 'BufferLineCycleNext', desc = 'Next Buffer' },
{ '[b', 'BufferLineCyclePrev', desc = 'Prev Buffer' },
{ ']b', 'BufferLineCycleNext', desc = 'Next Buffer' },
{ '[B', 'BufferLineMovePrev', desc = 'Move buffer prev' },
{ ']B', 'BufferLineMoveNext', desc = 'Move buffer next' },
},
config = function(_, opts)
require('bufferline').setup(vim.tbl_deep_extend('force', opts, { ---@type bufferline.Options
options = {
indicator = { style = 'underline' },
always_show_bufferline = false,
diagnostics = 'nvim_lsp',
diagnostics_indicator = function(_, _, diagnostics_dict, _)
local s = ' '
for e, n in pairs(diagnostics_dict) do
local sym = e == 'error' and ' ' or (e == 'warning' and ' ' or ' ')
s = s .. sym
end
return s
end,
offsets = {
{
filetype = 'neo-tree',
text = 'Neo-Tee',
highlight = 'Document',
separator = '┃', -- TODO: choose a thinner symbol
},
},
color_icons = true,
show_buffer_close_icons = false,
tab_size = 15,
separator_style = 'slant',
custom_filter = function(buf, bufnums)
if vim.bo[buf].filetype == 'qf' then
return false
end
-- Ignore unnamed buffers
if vim.api.nvim_buf_get_name(buf) == '' then
return false
end
return true
end,
},
}))
-- Fix bufferline when restoring a session
vim.api.nvim_create_autocmd({ 'BufAdd', 'BufDelete' }, {
callback = function()
vim.schedule(function()
pcall(nvim_bufferline)
end)
end,
desc = 'Fix bufferline when restoring a session',
})
end,
}
```

### Additional Information

_No response_

### commit

0b2fd86

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。