ALE-specific highlights get permanently lost when switching between dark and light background

Open
#4,915 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
vim
Domain
tooling

Research direction

Start by tracing ALE's highlight definitions and its handling of Vim's ColorScheme event, using the reported :set background=light and :set background=dark reproduction. Compare the signcolumn and virtual-text highlight behavior before and after switching backgrounds; done means ALE's error, warning, and info highlighting remains available without restarting Vim or manually reapplying links.

Written by the indexing model from the issue text.

Description

bug

Information

VIM version

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Feb 21 2025 00:08:16)
macOS version - x86_64

Operating System: MacOS

What went wrong

When you switch back-and-forth between dark and light background, ALE highlighting of errors in signcolumn and virtual text gets lost, and there is no way to bring it back short of restarting vim (e.g. reapplying the colorscheme, stopping/starting disabling/enabling ALE, etc)

I have added the following to my vimrc, and this does fix the issue, but obviously this is not ideal. Hopefully this is a clue to what's going wrong in the plugin.

function! ReapplyALEHighlights() abort
  highlight link ALEErrorSign error
  highlight link ALEStyleErrorSign ALEErrorSign
  highlight link ALEWarningSign todo
  highlight link ALEStyleWarningSign ALEWarningSign
  highlight link ALEInfoSign ALEWarningSign
  highlight link ALESignColumnWithErrors error
  " ...etc. etc., the rest of these things copy/pasted from ALE source code
endfunction

augroup ConfigureColorscheme
  autocmd!
  autocmd ColorScheme retrobox call ReapplyALEHighlights()
augroup END

Reproducing the bug

  1. Have some lint errors in the buffer (signcolumn and/or virtual text)
  2. :set background=light
  3. Observe that both signcolumn and virtualtext are no longer highlighted
  4. :set background=dark
  5. Observe that both signcolumn and virtualtext are no longer highlighted
  6. Nothing at this point will bring the highlighting of signcolumn/virtualtext back (other than restarting vim)
:ALEInfo

Current Filetype: vim
Available Linters: ['ale_custom_linting_rules', 'vimls', 'vint']
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.

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 = 'auto'
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 = {'elixir': ['mix_format'], 'typescript': ['prettier'], 'typescriptreact': ['prettier'], 'html': ['prettier'], 'javascript': ['eslint'], 'css': ['prettier'], 'eelixir': ['mix_format']}
let g:ale_history_enabled = 1
let g:ale_info_default_mode = 'preview'
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 = 0
let g:ale_lint_on_filetype_changed = 0
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 0
let g:ale_linter_aliases = {}
let g:ale_linters = {'elixir': ['elixir-ls'], 'typescript': ['tsserver'], 'typescriptreact': ['tsserver'], 'ruby': ['ruby'], 'javascript': ['eslint', 'tsserver']}
let g:ale_linters_explicit = 1
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_max_buffer_history_size = v:null
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_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 0
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_type_map = v:null
let g:ale_use_neovim_diagnostics_api = 0
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 'all'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1

Command History:

Dominant language
Vim Script
Stars
14k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dense-analysis/ale

All issues in dense-analysis/ale

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.