From 92ade713f2c9c57bffa3b62550d2fbcd3f5d5d4a Mon Sep 17 00:00:00 2001 From: w0rp Date: Wed, 24 May 2017 10:23:13 +0100 Subject: [PATCH] #323 Document ale#statusline#Count() instead, and encourage its use --- autoload/ale/statusline.vim | 3 +++ doc/ale.txt | 26 ++++++++++---------------- plugin/ale.vim | 7 ++----- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/autoload/ale/statusline.vim b/autoload/ale/statusline.vim index bec8a6e..673748c 100644 --- a/autoload/ale/statusline.vim +++ b/autoload/ale/statusline.vim @@ -90,6 +90,9 @@ function! s:StatusForListFormat() abort endfunction " Returns a formatted string that can be integrated in the statusline. +" +" This function is deprecated, and should not be used. Use the airline plugin +" instead, or write your own status function with ale#statusline#Count() function! ale#statusline#Status() abort if !exists('g:ale_statusline_format') return 'OK' diff --git a/doc/ale.txt b/doc/ale.txt index 207f574..c8aa154 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -646,17 +646,6 @@ g:ale_sign_warning *g:ale_sign_warning* The sign for warnings in the sign gutter. -g:ale_statusline_format *g:ale_statusline_format* - - Type: |List| - Default: `['%d error(s)', '%d warning(s)', 'OK']` - - This variable defines the format of |`ale#statusline#status()`| output. - - The 1st element is for errors - - The 2nd element is for warnings - - The 3rd element is for when no errors are detected - - g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace* b:ale_warn_about_trailing_whitespace *b:ale_warn_about_trailing_whitespace* @@ -1102,12 +1091,17 @@ ale#linter#Get(filetype) *ale#linter#Get()* components. -ale#statusline#Status() *ale#statusline#Status()* +ale#statusline#Count() *ale#statusline#Count()* - Return a formatted string that can be added to the statusline. - The output's format is defined in |`g:ale_statusline_format`|. - To enable it, the following should be present in your |statusline| settings: > - %{ale#statusline#Status()} + Returns a |Dictionary| containing information about the number of problems + detected by ALE. The following keys are supported: + + `error` -> The number of problems with type `E` and `sub_type != 'style'` + `warning` -> The number of problems with type `W` and `sub_type != 'style'` + `info` -> The number of problems with type `I` + `style_error` -> The number of problems with type `E` and `sub_type == 'style'` + `style_warning` -> The number of problems with type `W` and `sub_type == 'style'` + `total` -> The total number of problems. ALELint *ALELint-autocmd* diff --git a/plugin/ale.vim b/plugin/ale.vim index cf97032..8c674a3 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -142,11 +142,8 @@ let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning') " This flag can be set to 0 to disable echoing when the cursor moves. let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1) -" String format for statusline -" Its a list where: -" * The 1st element is for errors -" * The 2nd element is for warnings -" * The 3rd element is when there are no errors +" A deprecated setting for ale#statusline#Status() +" See :help ale#statusline#Count() for getting status reports. let g:ale_statusline_format = get(g:, 'ale_statusline_format', \ ['%d error(s)', '%d warning(s)', 'OK'] \)