Skip to content

Commit e70aa60

Browse files
Fix #47: Only return a diagnostics component if there are actual diagnostics (#51)
* Fix #47: Only return a diagnostics component if there are actual diagnostics * Update lua/lsp-status/statusline.lua Fix typo, caught by @dhruvmanila Co-authored-by: Dhruv Manilawala <[email protected]> Co-authored-by: Dhruv Manilawala <[email protected]>
1 parent 60a3ad9 commit e70aa60

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/lsp-status/statusline.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ local function make_statusline_component(diagnostics_key)
1414
return function(bufh)
1515
bufh = bufh or vim.api.nvim_get_current_buf()
1616
local icon = icons[diagnostics_key] .. config.indicator_separator
17-
return (icon or '') .. diagnostics(bufh)[diagnostics_key]
17+
local _diagnostics = diagnostics(bufh)[diagnostics_key]
18+
if _diagnostics > 0 then return (icon or '') .. diagnostics(bufh)[diagnostics_key] end
1819
end
1920
end
2021

0 commit comments

Comments
 (0)