Closed dhruvmanila closed 3 years ago
Can you elaborate on what you mean by the statusline being filled with 0 values? At least with the default component, this does not happen for me, and I would in general expect people writing their own components to test for zero before including the relevant counter text.
Sure, sorry to be not clear, what I mean is with the help of this PR (https://github.com/nvim-lua/lsp-status.nvim/pull/39) there were four functions added for the four types of diagnostic information, namely the following:
require('lsp-status').status_errors
require('lsp-status').status_warnings
require('lsp-status').status_hints
require('lsp-status').status_info
Ignoring the spacing problem, we can see that even if there is no error, the function still returns the output:
I would in general expect people writing their own components to test for zero before including the relevant counter text.
I did create my own components but as the plugin provides an interface to get the same information, its a bit simpler. So, what I am recommending is to update the function such that the default behavior is to return only if the count is > 0.
Ah, I see. So, you would essentially propose changing https://github.com/nvim-lua/lsp-status.nvim/blob/60a3ad9dc2f43e0e512c242411541846a86eb7de/lua/lsp-status/statusline.lua#L17 to only return a string if the count is > 0, otherwise return nil
?
Yes, that's what I am proposing :)
For the following functions, it would be better if the information is returned only if the total count is greater than 0, otherwise the statusline will always be filled with 0 count diagnostic information.
status_errors
status_warnings
status_hints
status_info
Another way, if this is not preferred to be the default behavior, an option can be provided in the
config
function.