summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-12 23:04:46 +0100
committerw0rp <devw0rp@gmail.com>2017-10-12 23:04:54 +0100
commite71c4a8bea25e6998d4d852677790ad6bd5a7e68 (patch)
tree16f873ea882322768185a3b1a9ca1b3d1f9ee41e /autoload
parentdded246aba9c054e4b91748cd4269c6cda2a03df (diff)
downloadale-e71c4a8bea25e6998d4d852677790ad6bd5a7e68.zip
#965 - Support limiting the number of signs ALE will set
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/sign.vim20
1 files changed, 17 insertions, 3 deletions
diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim
index dc3c1109..1c439bc8 100644
--- a/autoload/ale/sign.vim
+++ b/autoload/ale/sign.vim
@@ -209,7 +209,17 @@ function! s:UpdateLineNumbers(buffer, current_sign_list, loclist) abort
endif
endfunction
-function! s:BuildSignMap(current_sign_list, grouped_items) abort
+function! s:BuildSignMap(buffer, current_sign_list, grouped_items) abort
+ let l:max_signs = ale#Var(a:buffer, 'max_signs')
+
+ if l:max_signs is 0
+ let l:selected_grouped_items = []
+ elseif type(l:max_signs) is type(0) && l:max_signs > 0
+ let l:selected_grouped_items = a:grouped_items[:l:max_signs - 1]
+ else
+ let l:selected_grouped_items = a:grouped_items
+ endif
+
let l:sign_map = {}
let l:sign_offset = g:ale_sign_offset
@@ -235,7 +245,7 @@ function! s:BuildSignMap(current_sign_list, grouped_items) abort
let l:sign_map[l:line] = l:sign_info
endfor
- for l:group in a:grouped_items
+ for l:group in l:selected_grouped_items
let l:line = l:group[0].lnum
let l:sign_info = get(l:sign_map, l:line, {
\ 'current_id_list': [],
@@ -346,7 +356,11 @@ function! ale#sign#SetSigns(buffer, loclist) abort
let l:grouped_items = s:GroupLoclistItems(a:buffer, a:loclist)
" Build a map of current and new signs, with the lines as the keys.
- let l:sign_map = s:BuildSignMap(l:current_sign_list, l:grouped_items)
+ let l:sign_map = s:BuildSignMap(
+ \ a:buffer,
+ \ l:current_sign_list,
+ \ l:grouped_items,
+ \)
let l:command_list = ale#sign#GetSignCommands(
\ a:buffer,