From 397126cf977a3c7448d8367d0a5b9c68a57aae83 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Mon, 4 Sep 2023 19:00:19 -0500 Subject: [PATCH] fix(nvim): properly show bubble for diags when lsp is not attached --- .../nvim/lua/plugins/configs/heirline.lua | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/dots/.config/nvim/lua/plugins/configs/heirline.lua b/dots/.config/nvim/lua/plugins/configs/heirline.lua index a21357c0..182bfb86 100644 --- a/dots/.config/nvim/lua/plugins/configs/heirline.lua +++ b/dots/.config/nvim/lua/plugins/configs/heirline.lua @@ -505,8 +505,10 @@ return { FileNameBlock, margin(1), { - condition = conditions.lsp_attached, { + condition = function() + return conditions.lsp_attached() or conditions.has_diagnostics() + end, { provider = seps.full.left, hl = { fg = colors.oniViolet, bg = utils.get_highlight("WinBarNC").bg }, @@ -520,31 +522,41 @@ return { }, { 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() - local names = {} - for _, server in ipairs(vim.lsp.get_clients({ bufnr = 0 })) do - table.insert(names, server.name) - end - return " " .. table.concat(names, ", ") - end, - hl = { fg = colors.sumiInk0, bg = colors.oniViolet2 }, - }, - { - provider = seps.full.right, - hl = function() - local bg = utils.get_highlight("WinBar").bg - if conditions.has_diagnostics() then - bg = colors.sumiInk2 - end - return { fg = colors.oniViolet2, bg = bg } - end, - }, + provider = function() + local names = {} + for _, server in ipairs(vim.lsp.get_clients({ bufnr = 0 })) do + table.insert(names, server.name) + end + return " " .. table.concat(names, ", ") + end, + hl = { fg = colors.sumiInk0, bg = colors.oniViolet2 }, + }, + { + provider = seps.full.right, + hl = function() + local bg = utils.get_highlight("WinBar").bg + if conditions.has_diagnostics() then + bg = colors.sumiInk2 + end + return { fg = colors.oniViolet2, bg = bg } + end, + }, + } }, { condition = conditions.has_diagnostics,