Ale: Suggestion: disable/enable/toggle commands with fixers

Created on 16 Feb 2018  路  3Comments  路  Source: dense-analysis/ale

Thank you so much for creating and maintaining ALE. It is fantastic!

I'd like to suggest that disable/enable/toggle commands be updated to work for fixers like they do linters. These ones:

:ALEDisable
:ALEDisableBuffer
:ALEEnable
:ALEEnableBuffer
:ALEToggle
:ALEToggleBuffer

So, for example, if I have this defined in my .vimrc:

let g:ale_linters = {
\  'python': ['pylint'],
\  'ruby': ['rubocop'],
\  'javascript': ['eslint', 'flow'],
\}
let g:ale_fixers = {
\  'python': ['yapf'],
\  'ruby': ['rubocop'],
\  'javascript': ['eslint', 'prettier'],
\  'json': ['prettier'],
\  'css': ['prettier'],
\  'markdown': ['prettier'],
\}
let g:ale_fix_on_save = 1

Then :ALEDisableBuffer would turn off the fixers from running on a buffer as it does with the linters.

Most helpful comment

Just leaving this here if someone wishes for a quick command to toggle fixing:
command! ALEToggleFixer execute "let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) ? 0 : 1"

All 3 comments

Turning fixing off with those commands would be a breaking change. I think if you want to turn fixers off, you can just change 1 to 0 for g:ale_fix_on_save. If you want a command which does both things, you can write one.

Yeah I can do that. It just seems a little weird to me that the ALE enable/disable/toggle commands aren鈥檛 actually for ALE as a whole but just ALE linters. Anyways thanks again :) Closing.

Just leaving this here if someone wishes for a quick command to toggle fixing:
command! ALEToggleFixer execute "let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) ? 0 : 1"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amerov picture amerov  路  4Comments

aressler38 picture aressler38  路  3Comments

kronos29296 picture kronos29296  路  4Comments

trevordmiller picture trevordmiller  路  3Comments

ianchanning picture ianchanning  路  3Comments