parent
5283faa511
commit
f1b72218c3
@ -200,6 +200,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['javascript'],
|
\ 'suggested_filetypes': ['javascript'],
|
||||||
\ 'description': 'Fix JavaScript files using xo --fix.',
|
\ 'description': 'Fix JavaScript files using xo --fix.',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'qmlfmt': {
|
||||||
|
\ 'function': 'ale#fixers#qmlfmt#Fix',
|
||||||
|
\ 'suggested_filetypes': ['qml'],
|
||||||
|
\ 'description': 'Fix QML files with qmlfmt.',
|
||||||
|
\ },
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" Reset the function registry to the default entries.
|
" Reset the function registry to the default entries.
|
||||||
|
11
autoload/ale/fixers/qmlfmt.vim
Normal file
11
autoload/ale/fixers/qmlfmt.vim
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
call ale#Set('qml_qmlfmt_executable', 'qmlfmt')
|
||||||
|
|
||||||
|
function! ale#fixers#qmlfmt#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'qml_qmlfmt_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#fixers#qmlfmt#Fix(buffer) abort
|
||||||
|
return {
|
||||||
|
\ 'command': ale#Escape(ale#fixers#qmlfmt#GetExecutable(a:buffer)),
|
||||||
|
\}
|
||||||
|
endfunction
|
12
test/fixers/test_qmlfmt_fixer_callback.vader
Normal file
12
test/fixers/test_qmlfmt_fixer_callback.vader
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Before:
|
||||||
|
Save g:ale_qml_qmlfmt_executable
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
Execute(The qmlfmt fixer should use the options you set):
|
||||||
|
let g:ale_qml_qmlfmt_executable = 'foo-exe'
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {'command': ale#Escape('foo-exe')},
|
||||||
|
\ ale#fixers#qmlfmt#Fix(bufnr(''))
|
Loading…
Reference in New Issue
Block a user