Support reading from both output streams, and fix PHP error parsing, which sometimes logs to stderr, sometimes stdout.
This commit is contained in:
parent
f0f17e4b0d
commit
d97e25a260
@ -39,7 +39,7 @@ endfunction
|
|||||||
call ALEAddLinter('php', {
|
call ALEAddLinter('php', {
|
||||||
\ 'name': 'php',
|
\ 'name': 'php',
|
||||||
\ 'executable': 'php',
|
\ 'executable': 'php',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'both',
|
||||||
\ 'command': 'php -l --',
|
\ 'command': 'php -l --',
|
||||||
\ 'callback': 'ale_linters#php#php#Handle',
|
\ 'callback': 'ale_linters#php#php#Handle',
|
||||||
\})
|
\})
|
||||||
|
10
doc/ale.txt
10
doc/ale.txt
@ -324,10 +324,12 @@ ALEAddLinter(filetype, linter) *ALEAddLinter()*
|
|||||||
|
|
||||||
`output_stream` A |String| for the output stream the lines of output
|
`output_stream` A |String| for the output stream the lines of output
|
||||||
should be read from for the command which is run. The
|
should be read from for the command which is run. The
|
||||||
accepted values are `'stdout'` and `'stderr'`. This
|
accepted values are `'stdout'`, `'stderr'`, and
|
||||||
argument defaults to `'stdout'`. This argument can be
|
`'both'`. This argument defaults to `'stdout'`. This
|
||||||
set for linter programs which output their errors and
|
argument can be set for linter programs which output
|
||||||
warnings to the stderr stream instead of stdout.
|
their errors and warnings to the stderr stream
|
||||||
|
instead of stdout. The option `'both'` will read
|
||||||
|
from both stder and stdout at the same time.
|
||||||
|
|
||||||
Some programs for checking for errors are not capable of receiving input
|
Some programs for checking for errors are not capable of receiving input
|
||||||
from stdin, as is required by ALE. To remedy this, a wrapper script is
|
from stdin, as is required by ALE. To remedy this, a wrapper script is
|
||||||
|
@ -184,6 +184,12 @@ function! s:ApplyLinter(buffer, linter)
|
|||||||
\ 'on_stderr': 's:GatherOutputNeoVim',
|
\ 'on_stderr': 's:GatherOutputNeoVim',
|
||||||
\ 'on_exit': 's:HandleExitNeoVim',
|
\ 'on_exit': 's:HandleExitNeoVim',
|
||||||
\})
|
\})
|
||||||
|
elseif a:linter.output_stream ==# 'both'
|
||||||
|
let a:linter.job = jobstart(command, {
|
||||||
|
\ 'on_stdout': 's:GatherOutputNeoVim',
|
||||||
|
\ 'on_stderr': 's:GatherOutputNeoVim',
|
||||||
|
\ 'on_exit': 's:HandleExitNeoVim',
|
||||||
|
\})
|
||||||
else
|
else
|
||||||
let a:linter.job = jobstart(command, {
|
let a:linter.job = jobstart(command, {
|
||||||
\ 'on_stdout': 's:GatherOutputNeoVim',
|
\ 'on_stdout': 's:GatherOutputNeoVim',
|
||||||
@ -202,6 +208,10 @@ function! s:ApplyLinter(buffer, linter)
|
|||||||
if a:linter.output_stream ==# 'stderr'
|
if a:linter.output_stream ==# 'stderr'
|
||||||
" Read from stderr instead of stdout.
|
" Read from stderr instead of stdout.
|
||||||
let job_options.err_cb = function('s:GatherOutputVim')
|
let job_options.err_cb = function('s:GatherOutputVim')
|
||||||
|
elseif a:linter.output_stream ==# 'both'
|
||||||
|
" Read from both streams.
|
||||||
|
let job_options.out_cb = function('s:GatherOutputVim')
|
||||||
|
let job_options.err_cb = function('s:GatherOutputVim')
|
||||||
else
|
else
|
||||||
let job_options.out_cb = function('s:GatherOutputVim')
|
let job_options.out_cb = function('s:GatherOutputVim')
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user