Closed mgedmin closed 7 years ago
I tried to come up with some kind of formatting option which would support the following, all at once:
I tried a few different ideas, but so far I've just written things and started over again.
Full flexibility probably requires the user to write their own statusline formatting function. All ALE has to do then is provide the raw values via some sort of API.
ale#statusline#Count(buffer) seems like it could be used for this, which means I can do
fun! LinterStatus()
let total = ale#statusline#Count(bufnr('%')).total
return total == 0 ? '' : printf('{%d}', total)
endf
and then use %{LinterStatus()} instead of %{ALEGetStatusLine()}.
And, hey, it works perfectly! I think this bug can be closed.
(Edited to adapt to the latest API.)
@mgedmin I was thinking that. I think I'll document the Count
function. The API has changed slightly, to take the newer problem types into account. The sample code above won't work anymore, but accessing 0
and 1
from the result will, as the result is now a Dictionary
instead of a List
.
I just pushed a commit which adds documentation for ale#statusline#Count()
instead. The keys documented there should be available now and forever. The tests will ensure that the Status()
function continues to work until version 2.0, and the documentation encourages using Count()
instead.
My statusline is cluttered, so I'd prefer to see one counter showing the number of errors plus warnings, rather than two separate numbers.
I'm currently using
to save space, which means I get to look at
{1}{1}
when there's one error and one warning. I'd like there to be an option that would let me see just{2}
.