fix(nvim): properly show bubble for diags when lsp is not attached

This commit is contained in:
Price Hiller 2023-09-04 19:00:19 -05:00
parent 2c5ebe5d40
commit 397126cf97
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8

View File

@ -505,8 +505,10 @@ return {
FileNameBlock, FileNameBlock,
margin(1), margin(1),
{ {
condition = conditions.lsp_attached,
{ {
condition = function()
return conditions.lsp_attached() or conditions.has_diagnostics()
end,
{ {
provider = seps.full.left, provider = seps.full.left,
hl = { fg = colors.oniViolet, bg = utils.get_highlight("WinBarNC").bg }, hl = { fg = colors.oniViolet, bg = utils.get_highlight("WinBarNC").bg },
@ -520,31 +522,41 @@ return {
}, },
{ {
provider = seps.full.right, provider = seps.full.right,
hl = { fg = colors.oniViolet, bg = colors.oniViolet2 }, hl = function()
local bg = colors.oniViolet2
if conditions.has_diagnostics() and not conditions.lsp_attached() then
bg = colors.sumiInk2
end
return { fg = colors.oniViolet, bg = bg}
end
}, },
}, },
{ {
update = { "LspAttach", "LspDetach" }, condition = conditions.lsp_attached,
{
update = { "LspAttach", "LspDetach" },
provider = function() provider = function()
local names = {} local names = {}
for _, server in ipairs(vim.lsp.get_clients({ bufnr = 0 })) do for _, server in ipairs(vim.lsp.get_clients({ bufnr = 0 })) do
table.insert(names, server.name) table.insert(names, server.name)
end end
return " " .. table.concat(names, ", ") return " " .. table.concat(names, ", ")
end, end,
hl = { fg = colors.sumiInk0, bg = colors.oniViolet2 }, hl = { fg = colors.sumiInk0, bg = colors.oniViolet2 },
}, },
{ {
provider = seps.full.right, provider = seps.full.right,
hl = function() hl = function()
local bg = utils.get_highlight("WinBar").bg local bg = utils.get_highlight("WinBar").bg
if conditions.has_diagnostics() then if conditions.has_diagnostics() then
bg = colors.sumiInk2 bg = colors.sumiInk2
end end
return { fg = colors.oniViolet2, bg = bg } return { fg = colors.oniViolet2, bg = bg }
end, end,
}, },
}
}, },
{ {
condition = conditions.has_diagnostics, condition = conditions.has_diagnostics,