Fix 2269 - use ktlint stdin.
Use stdin flag instead of temporary files. This allows ktlint to work with .editorconfig files.
This commit is contained in:
parent
198361bc0d
commit
5035281cb9
4 changed files with 5 additions and 8 deletions
|
@ -6,5 +6,5 @@ call ale#linter#Define('kotlin', {
|
||||||
\ 'executable': 'ktlint',
|
\ 'executable': 'ktlint',
|
||||||
\ 'command': function('ale#handlers#ktlint#GetCommand'),
|
\ 'command': function('ale#handlers#ktlint#GetCommand'),
|
||||||
\ 'callback': 'ale#handlers#ktlint#Handle',
|
\ 'callback': 'ale#handlers#ktlint#Handle',
|
||||||
\ 'lint_file': 1
|
\ 'output_stream': 'stderr'
|
||||||
\})
|
\})
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
function! ale#fixers#ktlint#Fix(buffer) abort
|
function! ale#fixers#ktlint#Fix(buffer) abort
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format',
|
\ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format'
|
||||||
\ 'read_temporary_file': 1,
|
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
@ -13,7 +13,7 @@ function! ale#handlers#ktlint#GetCommand(buffer) abort
|
||||||
return ale#Escape(l:executable)
|
return ale#Escape(l:executable)
|
||||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||||
\ . (empty(l:rulesets) ? '' : ' ' . l:rulesets)
|
\ . (empty(l:rulesets) ? '' : ' ' . l:rulesets)
|
||||||
\ . ' %t'
|
\ . ' --stdin'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#handlers#ktlint#GetRulesets(buffer) abort
|
function! ale#handlers#ktlint#GetRulesets(buffer) abort
|
||||||
|
|
|
@ -21,9 +21,8 @@ Execute(The ktlint callback should return the correct default values):
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': ale#Escape('xxxinvalid')
|
\ 'command': ale#Escape('xxxinvalid')
|
||||||
\ . ' %t'
|
\ . ' --stdin'
|
||||||
\ . ' --format',
|
\ . ' --format',
|
||||||
\ 'read_temporary_file': 1,
|
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#ktlint#Fix(bufnr(''))
|
\ ale#fixers#ktlint#Fix(bufnr(''))
|
||||||
|
|
||||||
|
@ -37,8 +36,7 @@ Execute(The ktlint callback should include custom ktlint options):
|
||||||
\ 'command': ale#Escape('xxxinvalid')
|
\ 'command': ale#Escape('xxxinvalid')
|
||||||
\ . ' ' . g:ale_kotlin_ktlint_options
|
\ . ' ' . g:ale_kotlin_ktlint_options
|
||||||
\ . ' --ruleset /path/to/custom/ruleset.jar'
|
\ . ' --ruleset /path/to/custom/ruleset.jar'
|
||||||
\ . ' %t'
|
\ . ' --stdin'
|
||||||
\ . ' --format',
|
\ . ' --format',
|
||||||
\ 'read_temporary_file': 1,
|
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#ktlint#Fix(bufnr(''))
|
\ ale#fixers#ktlint#Fix(bufnr(''))
|
||||||
|
|
Reference in a new issue