Ale: The g:ale_fixers variable is not being respected

Created on 25 Sep 2020  路  10Comments  路  Source: dense-analysis/ale

Information

VIM version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 15 2019 16:41:15)
Included patches: 1-875, 878, 884, 948, 1046, 1365-1368, 1382, 1401

Operating System:

Debian 10 (buster)

What went wrong

The g:ale_fixers variable is note being respected, even though it is set in my vimrc file.

Reproducing the bug

I don't know how to reproduce this. The main thing is to report this so that I can know if others have this issue. If no one else has this problem with the latest (as of this writing) version of ALE, then it must be my setup. I will debug accordingly if it's me.

:ALEInfo

 Current Filetype: debchangelog
Available Linters: []
  Enabled Linters: []
  Ignored Linters: []
 Suggested Fixers: 
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
 Linter Variables:

 Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = v:null
let g:ale_command_wrapper = v:null
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = v:null
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {'vim': ['trim_whitespace', 'remove_trailing_lines'], 'sh': ['trim_whitespace', 'remove_trailing_lines'], 'php': ['trim_whitespace', 'remove_trailing_lines'], 'debchangelog': ['trim_whitespace', 'remove_trailing_lines'], 'sql': ['trim_whitespace', 'remove_trailing_lines'], 'css': ['trim_whitespace', 'remove_trailing_lines'], 'python': ['trim_whitespace', 'remove_trailing_lines', 'add_blank_lines_for_python_control_statements']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = v:null
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = v:null
let g:ale_list_window_size = v:null
let g:ale_loclist_msg_format = v:null
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = v:null
let g:ale_maximum_file_size = v:null
let g:ale_open_list = v:null
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = v:null
let g:ale_sign_error = v:null
let g:ale_sign_info = v:null
let g:ale_sign_offset = v:null
let g:ale_sign_style_error = v:null
let g:ale_sign_style_warning = v:null
let g:ale_sign_warning = v:null
let g:ale_sign_highlight_linenrs = v:null
let g:ale_statusline_format = v:null
let g:ale_type_map = v:null
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
  Command History:
bug

Most helpful comment

On Tue, 2020-12-22 at 05:17 -0800, Horacio Sanson wrote:

@lifecrisis the ALEInfo posted seems to be correct. You are editing a file of filetype debchangelog and your configuration for g:ale_fixers has this:
let g:ale_fixers = { 'debchangelog': ['trim_whitespace', 'remove_trailing_lines'], ...}
And ALEInfo is correctly reporting:
Suggested Fixers:
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.

At the time that I reported this issue, the problem was that these
fixers were not being executed on save. The variable was set correctly,
but the fixers were not being run.

I don't think this problem persists for me at this time.

--
Jason

All 10 comments

I can report that I am facing the same issue after I upgraded my OS from Ubuntu 18.04 to 20.04.

I'm having the same issue on Void Linux. For now, my workaround is using an autocmd in my init.vim, so that I can call a fixer for each type of file. Since I only code in C, I have:
autocmd bufreadpost,bufnewfile *.c :let b:ale_fixers=['uncrustify']

Oddly enough, this issue seems to have gone away for me. I will report if it ever comes back.

An update seems to have fixed the issue for me.

I'm having the same issue on Ubuntu 20.04, @snobknob workaround didn't seem to work for rustfmt:

autocmd bufreadpost,bufnewfile *.rs :let b:ale_fixers=['rustfmt']

@tl-rodrigo-gryzinski are you sure you have rustfmt installed and configured? ALE doesn't do that automatically.

@snobknob I do, I've installed it through rustup:

$ which rustfmt
/home/rogryza/.cargo/bin/rustfmt

Can you test another fixer, preferably for another language? If it works, rustfmt may not be working with ALE (you then can open a different issue for that). However, if it doesn't work, it is possible your installation is misconfigured.

@snobknob prettier and eslint are working for js and ts files. Also, rustfmt sometimes works once, though it's very rare and I haven't noticed any pattern yet.

@lifecrisis the ALEInfo posted seems to be correct. You are editing a file of filetype debchangelog and your configuration for g:ale_fixers has this:

let g:ale_fixers = { 'debchangelog': ['trim_whitespace', 'remove_trailing_lines'], ...}

And ALEInfo is correctly reporting:

 Suggested Fixers: 
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.

On Tue, 2020-12-22 at 05:17 -0800, Horacio Sanson wrote:

@lifecrisis the ALEInfo posted seems to be correct. You are editing a file of filetype debchangelog and your configuration for g:ale_fixers has this:
let g:ale_fixers = { 'debchangelog': ['trim_whitespace', 'remove_trailing_lines'], ...}
And ALEInfo is correctly reporting:
Suggested Fixers:
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.

At the time that I reported this issue, the problem was that these
fixers were not being executed on save. The variable was set correctly,
but the fixers were not being run.

I don't think this problem persists for me at this time.

--
Jason

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kronos29296 picture kronos29296  路  4Comments

trevordmiller picture trevordmiller  路  3Comments

glepnir picture glepnir  路  3Comments

plexigras picture plexigras  路  3Comments

janhellmich picture janhellmich  路  3Comments