summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-03-12 22:34:32 +0000
committerw0rp <devw0rp@gmail.com>2017-03-12 22:34:32 +0000
commit382e569f668f7d7f1e21ff705a124cad54dabef1 (patch)
treef5b4b450cfd07c8ee3146b9db94789f0abbca403
parentf25a54326054d1403047523e0e1bdf75d5cfc9c9 (diff)
downloadale-382e569f668f7d7f1e21ff705a124cad54dabef1.zip
Revert "Don't save the sign ID on loclist items. This approach won't work."
This reverts commit f25a54326054d1403047523e0e1bdf75d5cfc9c9.
-rw-r--r--autoload/ale/sign.vim10
-rw-r--r--test/test_linting_updates_loclist.vader2
2 files changed, 11 insertions, 1 deletions
diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim
index 99af2b17..1a39ba89 100644
--- a/autoload/ale/sign.vim
+++ b/autoload/ale/sign.vim
@@ -118,12 +118,20 @@ function! ale#sign#SetSigns(buffer, loclist) abort
" Add the new signs,
for l:index in range(0, len(l:signlist) - 1)
+ let l:sign_id = l:index + g:ale_sign_offset + 1
let l:sublist = l:signlist[l:index]
let l:type = !empty(filter(copy(l:sublist), 'v:val.type ==# ''E'''))
\ ? 'ALEErrorSign'
\ : 'ALEWarningSign'
- let l:sign_line = 'sign place ' . (l:index + g:ale_sign_offset + 1)
+ " Save the sign IDs we are setting back on our loclist objects.
+ " These IDs can be used later for changing line numbers of items
+ " we keep, based on what Vim adjusts automatically.
+ for l:obj in l:sublist
+ let l:obj.sign_id = l:sign_id
+ endfor
+
+ let l:sign_line = 'sign place ' . l:sign_id
\. ' line=' . l:sublist[0].lnum
\. ' name=' . l:type
\. ' buffer=' . a:buffer
diff --git a/test/test_linting_updates_loclist.vader b/test/test_linting_updates_loclist.vader
index 06f11d8b..2e106d05 100644
--- a/test/test_linting_updates_loclist.vader
+++ b/test/test_linting_updates_loclist.vader
@@ -13,6 +13,7 @@ Before:
\ 'type': 'W',
\ 'col': 10,
\ 'text': 'Infix operators must be spaced. [Warning/space-infix-ops]',
+ \ 'sign_id': 1000001,
\ },
\ {
\ 'lnum': 2,
@@ -23,6 +24,7 @@ Before:
\ 'type': 'E',
\ 'col': 10,
\ 'text': 'Missing semicolon. [Error/semi]',
+ \ 'sign_id': 1000002,
\ }
\]