diff options
-rw-r--r-- | autoload/ale/engine.vim | 16 | ||||
-rw-r--r-- | plugin/ale.vim | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index 185d54db..2720e901 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -553,6 +553,18 @@ function! s:AddProblemsFromOtherBuffers(buffer, linters) abort endif endfunction +function! s:AddLinterError(buffer, linter) abort + let l:output = [] + call add(l:output, { + \ 'lnum': 1, + \ 'end_lnum': ale#util#GetLineCount(a:buffer), + \ 'text': 'Linter failure (' . a:linter . ')', + \ 'detail': 'Failed to execute ' . a:linter, + \ 'type': 'E'} + \ ) + call ale#other_source#ShowResults(bufnr(''), 'ale-vim', l:output) +endfunction + function! s:RunIfExecutable(buffer, linter, lint_file, executable) abort if ale#command#IsDeferred(a:executable) let a:executable.result_callback = { @@ -597,6 +609,10 @@ function! s:RunIfExecutable(buffer, linter, lint_file, executable) abort \} return s:RunJob(l:command, l:options) + else + if ale#Var(a:buffer, 'error_on_lint_fail') + call s:AddLinterError(a:buffer, a:executable) + endif endif return 0 diff --git a/plugin/ale.vim b/plugin/ale.vim index f9b6cab8..ecf4f10a 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -169,6 +169,9 @@ let g:ale_history_enabled = get(g:, 'ale_history_enabled', 1) " A flag for storing the full output of commands in the history. let g:ale_history_log_output = get(g:, 'ale_history_log_output', 1) +" A flag for indicating error on linter failure. +let g:ale_error_on_lint_fail = get(g:, 'ale_error_on_lint_fail', 0) + " Enable automatic completion with LSP servers and tsserver let g:ale_completion_enabled = get(g:, 'ale_completion_enabled', 0) |