diff options
author | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
commit | 217284360d35711b751859ed27a7a3c3da300e85 (patch) | |
tree | 4b26a84b397e3ac15a8b13a572b1f9a50312dbab /ale_linters/scala/fsc.vim | |
parent | 9ef266d050d698c3ed3be3456ce6a5da5755d5ef (diff) | |
download | ale-217284360d35711b751859ed27a7a3c3da300e85.zip |
Simplify the code for most linters and tests with closures
Diffstat (limited to 'ale_linters/scala/fsc.vim')
-rw-r--r-- | ale_linters/scala/fsc.vim | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/ale_linters/scala/fsc.vim b/ale_linters/scala/fsc.vim index 17b26f0b..fbdce20e 100644 --- a/ale_linters/scala/fsc.vim +++ b/ale_linters/scala/fsc.vim @@ -1,29 +1,14 @@ " Author: Nils Leuzinger - https://github.com/PawkyPenguin " Description: Basic scala support using fsc -" -function! ale_linters#scala#fsc#GetExecutable(buffer) abort - if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0 - " Don't check sbt files - return '' - endif - return 'fsc' -endfunction - -function! ale_linters#scala#fsc#GetCommand(buffer) abort - let l:executable = ale_linters#scala#fsc#GetExecutable(a:buffer) - - if empty(l:executable) - return '' - endif - - return ale#Escape(l:executable) . ' -Ystop-after:parser %t' +function! s:IsSbt(buffer) abort + return index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0 endfunction call ale#linter#Define('scala', { \ 'name': 'fsc', -\ 'executable_callback': 'ale_linters#scala#fsc#GetExecutable', -\ 'command_callback': 'ale_linters#scala#fsc#GetCommand', +\ 'executable_callback': {buf -> s:IsSbt(buf) ? '' : 'fsc'}, +\ 'command': '%e -Ystop-after:parser %t', \ 'callback': 'ale#handlers#scala#HandleScalacLintFormat', \ 'output_stream': 'stderr', \}) |