diff options
author | Jesse Harris <zigford@gmail.com> | 2019-06-20 08:35:10 +1000 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2019-06-19 23:35:10 +0100 |
commit | 9ad8fd6a1bdff5f0c80cf921df5628d1d322cf82 (patch) | |
tree | 63919838c450d460126b14272eb1fd6db98e3f65 /ale_linters/powershell | |
parent | d2c3141f266270a098d798c0d273a1068bdc5568 (diff) | |
download | ale-9ad8fd6a1bdff5f0c80cf921df5628d1d322cf82.zip |
Handle powershell unexpected token with newline (#2588)
* Newline in unexpected token broke parser
* fixed test to properly capture regressions
* removed deprecated linter options for powershell
Diffstat (limited to 'ale_linters/powershell')
-rwxr-xr-x | ale_linters/powershell/powershell.vim | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/ale_linters/powershell/powershell.vim b/ale_linters/powershell/powershell.vim index 51ded71d..a63191fd 100755 --- a/ale_linters/powershell/powershell.vim +++ b/ale_linters/powershell/powershell.vim @@ -49,11 +49,19 @@ function! ale_linters#powershell#powershell#Handle(buffer, lines) abort let l:matchcount = 1 endif - let l:item = { - \ 'lnum': str2nr(l:match[1]), - \ 'col': str2nr(l:match[2]), - \ 'type': 'E', - \} + " If the match is 0, it was a failed match + " probably due to an unexpected token which + " contained a newline. Reset matchcount. to + " continue to the next match + if !empty(l:match[1]) + let l:item = { + \ 'lnum': str2nr(l:match[1]), + \ 'col': str2nr(l:match[2]), + \ 'type': 'E', + \} + else + let l:matchcount = 0 + endif elseif l:matchcount == 2 " Second match[0] grabs the full line in order " to handles the text @@ -84,8 +92,8 @@ endfunction call ale#linter#Define('powershell', { \ 'name': 'powershell', -\ 'executable_callback': 'ale_linters#powershell#powershell#GetExecutable', -\ 'command_callback': 'ale_linters#powershell#powershell#GetCommand', +\ 'executable': function('ale_linters#powershell#powershell#GetExecutable'), +\ 'command': function('ale_linters#powershell#powershell#GetCommand'), \ 'output_stream': 'stdout', \ 'callback': 'ale_linters#powershell#powershell#Handle', \}) |