summaryrefslogtreecommitdiff
path: root/ale_linters/php/php.vim
diff options
context:
space:
mode:
authorAdriaan Zonnenberg <amz@adriaan.xyz>2017-05-17 21:28:29 +0200
committerAdriaan Zonnenberg <amz@adriaan.xyz>2017-05-17 21:28:29 +0200
commit05970e1b28fdac59df04f11b85ccac3b65362bc7 (patch)
tree56c430117fa620d8eadf241ced23ef17b10917b9 /ale_linters/php/php.vim
parent6299da7bd39790ca996516f46f09482585fb9035 (diff)
downloadale-05970e1b28fdac59df04f11b85ccac3b65362bc7.zip
Add end columns on php linter #538
Diffstat (limited to 'ale_linters/php/php.vim')
-rw-r--r--ale_linters/php/php.vim16
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