dense-analysis / ale

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

ale_virtualtext, ale_sign and highlight color shows abnormal in nvim #4706

Open marslo opened 8 months ago

marslo commented 8 months ago

Information

VIM version

$ command vim --version  | head -2
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 14 2023 13:53:53)
macOS version - x86_64

NVIM version

$ command nvim --version | head -2
NVIM v0.9.5
Build type: Release

Operating System:

$ sw_vers
ProductName:        macOS
ProductVersion:     14.2.1
BuildVersion:       23C71

What went wrong

I'm using exact same vimrc for both vim and nvim, and ale_virtualtext, ale_sign and highlight color shows abnormal in nvim ( works in vim ) as below:

probably related with

To verify my assumption, I've tried to manually added the diff ( 4704.patch ) into HEAD of commit a3183e2f7b9120c2f1d49f0156519663f355d35d, but still no help

Reproducing the bug

here is the source code of shell script:

#!/usr/bin/env bash

echo $#
echo ${1:-.}
echo ${2:--10}

:ALEInfo

click here to expand ...
 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 = '✘'
let g:ale_echo_msg_format = '[%linter%] %code%: %s [%severity%] '
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = '⚠'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'groovy': ['checkstyle'], '*': ['remove_trailing_lines', 'trim_whitespace'], 'css': ['stylelint']}
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 = 'never'
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 = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '[%linter%] %code%: %s [%severity%] '
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 = 1
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 1
let g:ale_set_signs = 1
let g:ale_sign_column_always = 1
let g:ale_sign_error = '💢'
let g:ale_sign_info = 'ᓆ'
let g:ale_sign_offset = v:null
let g:ale_sign_style_error = '⍥'
let g:ale_sign_style_warning = 'ᓍ'
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.
  Command History:

(executable check - success) bashate
(finished - exit code 0) ['/usr/local/bin/bash', '-c', '''bashate''  ''/var/folders/s3/mg_f3cv54nn7y758j_t46zt40000gn/T/nvim.marslo/bv1Zwl/0/ale-bug.sh''']

<<>>

(executable check - failure) cspell
(executable check - success) bash
(finished - exit code 0) ['/usr/local/bin/bash', '-c', 'bash -n ''/var/folders/s3/mg_f3cv54nn7y758j_t46zt40000gn/T/nvim.marslo/bv1Zwl/2/ale-bug.sh''']

<<>>

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

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

(finished - exit code 1) ['/usr/local/bin/bash', '-c', 'cd ''/Users/marslo'' && ''shellcheck'' -s bash -x -f gcc - < ''/var/folders/s3/mg_f3cv54nn7y758j_t46zt40000gn/T/nvim.marslo/bv1Zwl/3/ale-bug.sh''']

<<>>
-:4:6: note: Double quote to prevent globbing and word splitting. [SC2086]
-:5:6: note: Double quote to prevent globbing and word splitting. [SC2086]
<<>>
hsanson commented 6 months ago

Just a guess but I think in Nvim case it is using Nvim LSP diagnostics UI instead of ALE's. Try disabling nvim diagnostics integration:

let  g:ale_use_neovim_diagnostics_api = 0

Read about this option for more details. When this is enabled most of ALE's UI features (e.g. signs, highlight, virtualtext) are disabled and instead it leaves NVim to handle it.