dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.38k stars 1.42k forks source link

Strange syntax highlighting behavior with ALE on Neovim #4787

Open amini-allight opened 1 month ago

amini-allight commented 1 month ago

Information

NVIM v0.10.0 Build type: Release

Operating System: Arch Linux

What went wrong

On May 16th I updated to the then-latest version of ALE and noticed that ALE had started using underlines for error/warning highlighting instead of my usual reverse color highlights. I thought this was odd but the colors were bright and visible so I ignored it. Later on May 25th Neovim updated to its new 0.10.0 version and broke my theme by setting termguicolors on by default. Once I fixed this by turning that setting back off I noticed ALE was still using underlines for/warning highlighting except now they were in pale washed out pinks and yellows so I decided to investigate.

I discovered that ALE seems to be ignoring my ALEError and ALEWarning highlights entirely. Instead it's using DiagnosticUnderlineError and DiagnosticUnderlineWarn. Using these two highlights I was able to customize the color of the underline (or change it from an underline back to a reverse highlight if I wanted). The symbols in the sign column are still styled correctly.

This behavior persists in the latest version of ALE.

I'm not sure if this is a bug or just me not understanding something but I wasn't able to find any documentation for ALE mentioning DiagnosticUnderlineError/DiagnosticUnderlineWarn and it seems to contradict the documentation for ALEError/ALEWarn so I decided to report it.

Reproducing the bug

  1. Use the latest version of ALE and use a linter to highlight an error.
  2. Compare the style to those displayed for various highlights when running the :hi command without any arguments.
  3. Using Neovim may be required. I haven't tested on other versions.

:ALEInfo

Expand ``` let g:ale_cache_executable_check_failures = v:null let g:ale_change_sign_column_color = v:null let g:ale_command_wrapper = '' let g:ale_completion_delay = 100 let g:ale_completion_enabled = 1 let g:ale_completion_max_suggestions = 5 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 = '%code: %%s' 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 = 0 let g:ale_fixers = {} 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 = 0 let g:ale_lint_delay = 50 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 = {'c': ['clangd'], 'cpp': ['clangd']} let g:ale_linters_explicit = 0 let g:ale_linters_ignore = {} let g:ale_list_vertical = 0 let g:ale_list_window_size = 10 let g:ale_loclist_msg_format = '%code: %%s' 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 = 0 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 = 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 = 1 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 = {} let g:ale_use_neovim_diagnostics_api = 1 let g:ale_use_global_executables = v:null let g:ale_virtualtext_cursor = 'disabled' let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 ```
w0rp commented 1 month ago

I think I need to update the documentation to link to the standard Neovim highlight groups and mention that the ALE highlights aren't used when displaying problems with Neovim's diagnostics, which is the default for ALE with Neovim 0.8+. It's the default because it makes it easier to group problems together with diagnostics other than the ones from ALE.