diff options
author | w0rp <w0rp@users.noreply.github.com> | 2017-05-18 09:38:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-18 09:38:15 +0100 |
commit | bb1f045d59e93b0565927f1e887e3e7a3a11e61b (patch) | |
tree | dc34cd8532c289025ad2e98855efef976b27602f /ale_linters | |
parent | cdf0fb39e532b0e0ed67ac8dcd088b58d822b74e (diff) | |
parent | 05970e1b28fdac59df04f11b85ccac3b65362bc7 (diff) | |
download | ale-bb1f045d59e93b0565927f1e887e3e7a3a11e61b.zip |
Merge pull request #564 from adriaanzon/php-end-columns
Add end columns on php linter
Diffstat (limited to 'ale_linters')
-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 |