I want to configure my Ruby fixer to perform the following sequence:
- Turn syntax off
- Run the rubocop fixer
- Turn syntax on
According to :help ale-fix-configuration
:
Synchronous functions and asynchronous jobs will be run in a sequence for fixing files, and can be combined. For example:
let g:ale_fixers = {
\ 'javascript': [
\ 'DoSomething',
\ 'eslint',
\ {buffer, lines -> filter(lines, 'v:val !=~ ''^\s*//''')},
\ ],
\}
I tried to follow the example:
function! SyntaxTurnOff()
exec "syntax off"
endfunction
function! SyntaxTurnOn()
exec "syntax on"
endfunction
" FIXERS
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'ruby': [
\ 'SyntaxTurnOff',
\ 'rubocop',
\ 'SyntaxTurnOn',
\],
\ 'python': ['flake8'],
\ 'json': ['jq'],
\}
However, when I try to execute it by calling :ALEFix
in the editor, I get the following error:
Error detected while processing function ale#fix#Fix[37]..<SNR>305_RunFixer:
line 17:
E118: Too many arguments for function: SyntaxTurnOff
What am I doing wrong?