ale icon indicating copy to clipboard operation
ale copied to clipboard

Signs cannot be customized

Open mooreye opened this issue 9 months ago • 5 comments

Information

VIM version NVIM v0.9.5

Operating System: Fedora 40

What went wrong

On master branch, the following customizations have no effect: https://github.com/dense-analysis/ale?tab=readme-ov-file#how-can-i-customise-signs The signs are always I, W, and E. Also, let g:ale_sign_column_always = 1 doesn't keep the column always visible.

On tagged release 3.3.0 there is no issue.

Reproducing the bug

  1. Install shellcheck
  2. Open test.sh file with contents:
#!/bin/bash

echo $a
  1. Run nvim command let g:ale_sign_warning = '--'
  2. The last line's column warning sign is still W

:ALEInfo

Current Filetype: sh Available Linters: ['bashate', 'cspell', 'language_server', 'shell', 'shellcheck'] Enabled Linters: ['bashate', 'cspell', 'language_server', 'shell', 'shellcheck'] Ignored Linters: [] Suggested Fixers: 'remove_trailing_lines' - Remove all blank lines at the end of a file. 'shfmt' - Fix sh files with shfmt. 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.

Linter Variables: " Press Space to read :help for a setting let g:ale_sh_bashate_executable = 'bashate' let g:ale_sh_bashate_options = '' let g:ale_sh_language_server_executable = 'bash-language-server' let g:ale_sh_language_server_use_global = 0 let g:ale_sh_shell_default_shell = 'bash' let g:ale_sh_shellcheck_change_directory = 1 let g:ale_sh_shellcheck_dialect = 'auto' let g:ale_sh_shellcheck_exclusions = '' let g:ale_sh_shellcheck_executable = 'shellcheck' let g:ale_sh_shellcheck_options = ''

Global Variables: " Press Space to read :help for a setting 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 = 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 = '%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 = {'sh': ['shfmt'], '*': ['remove_trailing_lines', 'trim_whitespace'], 'python': ['black']} 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 = 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 = {'perl': ['perl'], 'json': ['jq']} 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 = 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 = '--' 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 = 'all' let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1

LSP Error Messages:

(Errors for language_server) Failed to find project root, language server won't start. Failed to find project root, language server won't start. Command History:

(executable check - failure) bashate (executable check - failure) cspell (executable check - success) bash (finished - exit code 0) ['/usr/bin/bash', '-c', 'bash -n ''/tmp/nvim.user/W4Z41K/1/dupa.sh''']

<<<NO OUTPUT RETURNED>>>

(executable check - success) shellcheck (finished - exit code 0) ['/usr/bin/bash', '-c', 'cd ''/tmp/opt/'' && ''shellcheck'' --version']

<<<OUTPUT STARTS>>> ShellCheck - shell script analysis tool version: 0.9.0 license: GNU General Public License, version 3 website: https://www.shellcheck.net <<<OUTPUT ENDS>>>

(finished - exit code 0) ['/usr/bin/bash', '-c', 'cd ''/tmp/opt/'' && ''shellcheck'' -s bash -x -f json1 - < ''/tmp/nvim.user/W4Z41K/2/dupa.sh''']

<<<OUTPUT STARTS>>> {"comments":[]} <<<OUTPUT ENDS>>>

(executable check - failure) bashate (executable check - failure) cspell (finished - exit code 0) ['/usr/bin/bash', '-c', 'bash -n ''/tmp/nvim.user/W4Z41K/3/dupa.sh''']

<<<NO OUTPUT RETURNED>>>

(finished - exit code 1) ['/usr/bin/bash', '-c', 'cd ''/tmp/opt/'' && ''shellcheck'' -s bash -x -f json1 - < ''/tmp/nvim.user/W4Z41K/4/dupa.sh''']

<<<OUTPUT STARTS>>> {"comments":[{"file":"-","line":3,"endLine":3,"column":6,"endColumn":8,"level":"warning","code":2154,"message":"a is referenced but not assigned.","fix":null},{"file":"-","line":3,"endLine":3,"column":6,"endColumn":8,"level":"info","code":2086,"message":"Double quote to prevent globbing and word splitting.","fix":{"replacements":[{"column":6,"endColumn":6,"endLine":3,"insertionPoint":"afterEnd","line":3,"precedence":7,"replacement":"""},{"column":8,"endColumn":8,"endLine":3,"insertionPoint":"beforeStart","line":3,"precedence":7,"replacement":"""}]}}]} <<<OUTPUT ENDS>>>

mooreye avatar May 15 '24 11:05 mooreye

I see the same issue Neovim 0.9.5.

This worked for me – as a workaround for setting custom sign symbols:

sign define DiagnosticSignError text=┃ texthl=DiagnosticSignError
sign define DiagnosticSignWarn text=┃ texthl=DiagnosticSignWarn

pmeinhardt avatar May 18 '24 14:05 pmeinhardt

And after some digging… found out you can also set this:

let g:ale_use_neovim_diagnostics_api = 0

It looks as if ALE will set signs via diagnostics on Neovim, but it does not define the corresponding signs.

References:

https://github.com/dense-analysis/ale/blob/c88bddfa83dbb96c2f57426794ed98a0e181ea7e/plugin/ale.vim#L202-L204

https://github.com/dense-analysis/ale/blob/c88bddfa83dbb96c2f57426794ed98a0e181ea7e/autoload/ale/engine.vim#L187-L189

https://github.com/dense-analysis/ale/blob/c88bddfa83dbb96c2f57426794ed98a0e181ea7e/autoload/ale/engine.vim#L247-L258

https://github.com/dense-analysis/ale/blob/c88bddfa83dbb96c2f57426794ed98a0e181ea7e/lua/ale/diagnostics.lua#L21

pmeinhardt avatar May 18 '24 15:05 pmeinhardt

I guess it depends on which you prefer:

  1. Handling issues via diagnostics on Neovim:
    • In this case customize the DiagnosticSign* definitions (see my first comment)
    • This should also make your sign customizations apply for diagnostic sources other than ALE
    • See :help sign-define
  2. Via ALE: In this case use let g:ale_use_neovim_diagnostics_api = 0 (see the comment just above)

pmeinhardt avatar May 18 '24 15:05 pmeinhardt

I see the same issue Neovim 0.9.5.

This worked for me – as a workaround for setting custom sign symbols:

sign define DiagnosticSignError text=┃ texthl=DiagnosticSignError
sign define DiagnosticSignWarn text=┃ texthl=DiagnosticSignWarn

I can confirm this works

mooreye avatar May 19 '24 09:05 mooreye

I'll have to update the documentation to make this more obvious. The default behaviour in newer Neovim versions is to use Neovim's diagnostic system to make it easier to combine ALE with other diagnostics.

w0rp avatar May 31 '24 07:05 w0rp

I see the same issue Neovim 0.9.5.

This worked for me – as a workaround for setting custom sign symbols:

sign define DiagnosticSignError text=┃ texthl=DiagnosticSignError
sign define DiagnosticSignWarn text=┃ texthl=DiagnosticSignWarn

Confirmed it works

Rose1917 avatar Oct 22 '24 05:10 Rose1917