Extend statusline interface (#2240)

* Extended statusline.vim to provide an efficient way to access the first errors,warnings,stylerrors,stylewarnings,etc from the loclist.
* Added documentation and help for the new API function.
This commit is contained in:
petpetpetpet
2019-01-27 12:44:49 +00:00
committed by w0rp
parent a7b3b84899
commit 3c38fdb1bb
4 changed files with 171 additions and 27 deletions

View File

@@ -578,8 +578,16 @@ let g:airline#extensions#ale#enabled = 1
```
If you don't want to use vim-airline, you can implement your own statusline
function without adding any other plugins. ALE provides a function for counting
the number of problems for this purpose, named `ale#statusline#Count`.
function without adding any other plugins. ALE provides some functions to
assist in this endeavour, including:
* `ale#statusline#Count`: Which returns the number of problems found by ALE
for a specified buffer.
* `ale#statusline#FirstProblem`: Which returns a dictionary containing the
full loclist details of the first problem of a specified type found by ALE
in a buffer. (e.g. The first style warning in the current buffer.)
This can be useful for displaying more detailed information such as the
line number of the first problem in a file.
Say you want to display all errors as one figure, and all non-errors as another
figure. You can do the following:
@@ -601,7 +609,8 @@ endfunction
set statusline=%{LinterStatus()}
```
See `:help ale#statusline#Count()` for more information.
See `:help ale#statusline#Count()` or `:help ale#statusline#FirstProblem()`
for more information.
<a name="faq-lightline"></a>