diff options
Diffstat (limited to 'ale_linters/php/php.vim')
-rw-r--r-- | ale_linters/php/php.vim | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ale_linters/php/php.vim b/ale_linters/php/php.vim index 7c9e8c18..7158c950 100644 --- a/ale_linters/php/php.vim +++ b/ale_linters/php/php.vim @@ -4,17 +4,23 @@ function! ale_linters#php#php#Handle(buffer, lines) abort " Matches patterns like the following: " - " PHP Parse error: syntax error, unexpected ';', expecting ']' in - on line 15 + " Parse error: syntax error, unexpected ';', expecting ']' in - on line 15 let l:pattern = '\v^%(Fatal|Parse) error:\s+(.+unexpected ''(.+)%(expecting.+)@<!''.*|.+) in - on line (\d+)' - let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { + let l:col = empty(l:match[2]) ? 0 : stridx(getline(l:match[3]), l:match[2]) + 1 + let l:obj = { \ 'lnum': l:match[3] + 0, - \ 'col': empty(l:match[2]) ? 0 : stridx(getline(l:match[3]), l:match[2]) + 1, + \ 'col': l:col, \ 'text': l:match[1], - \}) + \} + + if l:col != 0 + let l:obj.end_col = l:col + strlen(l:match[2]) - 1 + endif + + call add(l:output, l:obj) endfor return l:output |