diff options
author | w0rp <devw0rp@gmail.com> | 2018-05-15 18:01:32 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-05-15 18:01:49 +0100 |
commit | c1da7866d09be76886bd3d591949b327538a4315 (patch) | |
tree | 950f79daa0c77c3b55116b8ea4025cebece11632 /ale_linters | |
parent | c23acb00e27f14ba9c65a16a636e222e1ef082ff (diff) | |
download | ale-c1da7866d09be76886bd3d591949b327538a4315.zip |
Fix #1584 - Make duplicate msgfmt messages easier to navigate
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/po/msgfmt.vim | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ale_linters/po/msgfmt.vim b/ale_linters/po/msgfmt.vim index 578792bf..8279ccdc 100644 --- a/ale_linters/po/msgfmt.vim +++ b/ale_linters/po/msgfmt.vim @@ -1,10 +1,30 @@ " Author: Cian Butler https://github.com/butlerx " Description: msgfmt for PO files +function! ale_linters#po#msgfmt#Handle(buffer, lines) abort + let l:results = ale#handlers#unix#HandleAsWarning(a:buffer, a:lines) + let l:index = 0 + + for l:item in l:results + if l:index > 0 && l:item.text =~? 'this is the location of the first definition' + let l:last_item = l:results[l:index - 1] + + if l:last_item.text =~? 'duplicate message definition' + let l:last_item.text = 'duplicate of message at line ' . l:item.lnum + let l:item.text = 'first location of duplicate of message at line ' . l:last_item.lnum + endif + endif + + let l:index += 1 + endfor + + return l:results +endfunction + call ale#linter#Define('po', { \ 'name': 'msgfmt', \ 'executable': 'msgfmt', \ 'output_stream': 'stderr', \ 'command': 'msgfmt --statistics --output-file=- %t', -\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\ 'callback': 'ale_linters#po#msgfmt#Handle', \}) |