decide whether or not to run with config file based on the presence of config filename value

This commit is contained in:
Atsuya Takagi 2021-01-14 09:54:01 +09:00
parent e3e1ddce95
commit 8d5b3e827d

View file

@ -1,7 +1,6 @@
" Author: Atsuya Takagi <asoftonight@gmail.com> " Author: Atsuya Takagi <asoftonight@gmail.com>
" Description: A linter for Vala using Vala-Lint. " Description: A linter for Vala using Vala-Lint.
call ale#Set('vala_vala_lint_enable_config', 0)
call ale#Set('vala_vala_lint_config_filename', 'vala-lint.conf') call ale#Set('vala_vala_lint_config_filename', 'vala-lint.conf')
call ale#Set('vala_vala_lint_executable', 'io.elementary.vala-lint') call ale#Set('vala_vala_lint_executable', 'io.elementary.vala-lint')
@ -12,16 +11,14 @@ endfunction
function! ale_linters#vala#vala_lint#GetCommand(buffer) abort function! ale_linters#vala#vala_lint#GetCommand(buffer) abort
let l:command = ale_linters#vala#vala_lint#GetExecutable(a:buffer) let l:command = ale_linters#vala#vala_lint#GetExecutable(a:buffer)
if ale#Var(a:buffer, 'vala_vala_lint_enable_config')
let l:config_filename = ale#Var(a:buffer, 'vala_vala_lint_config_filename') let l:config_filename = ale#Var(a:buffer, 'vala_vala_lint_config_filename')
let l:config_path = ale#path#FindNearestFile(a:buffer, l:config_filename) let l:config_path = ale#path#FindNearestFile(a:buffer, l:config_filename)
if !empty(l:config_path) if !empty(l:config_path)
let l:command .= '-c ' . l:config_path . ' ' let l:command .= ' -c ' . l:config_path
endif
endif endif
return l:command . '%s' return l:command . ' %s'
endfunction endfunction
function! ale_linters#vala#vala_lint#Handle(buffer, lines) abort function! ale_linters#vala#vala_lint#Handle(buffer, lines) abort