install.fairie/dotfiles/.vim/plugged/ale/ale_linters/po/msgfmt.vim
Git E2E Dev Test Username e149692cc9 git subrepo clone https://github.com/dense-analysis/ale.git ./dotfiles/.vim/plugged/ale
subrepo:
  subdir:   "dotfiles/.vim/plugged/ale"
  merged:   "e4b205440"
upstream:
  origin:   "https://github.com/dense-analysis/ale.git"
  branch:   "master"
  commit:   "e4b205440"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:09 -04:00

30 lines
990 B
VimL

" 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_linters#po#msgfmt#Handle',
\})