dense-analysis / ale

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

Error when closing an ansible playbook from NeoVim when ansible-lint is loaded. #4498

Open SkrrtBacharach opened 1 year ago

SkrrtBacharach commented 1 year ago

Information

VIM version

NVIM v0.8.3 Build type: RelWithDebInfo

Operating System: Fedora 37

What went wrong

When you close an ansible playbook when Ale has ansible-lint loaded as a linter, the following error message apprears:

Error detected while processing function <SNR>66_NeoVimCallback[35]..function <SNR>66_NeoVimCallback[29]..<lambda>16[1]..<SNR>44_ExitCallback[28]..<SNR>43_HandleExit[30]..ale#engine#HandleLoclist[15]..ale#engine#FixLocList:
line   16:
E1098: String, List or Blob required

This does not happen when ansible-lint is not installed.

Reproducing the bug

I have written scripts to reproduce this issue in a container: https://github.com/SkrrtBacharach/ale_issue_4498

:ALEInfo

Expand
 Current Filetype: yaml.ansible
Available Linters: ['actionlint', 'circleci', 'gitlablint', 'yaml-language-server', 'spectral', 'swaglint', 'yamllint', 'ansible-language-server', 'ansible_lint']
   Linter Aliases:
'ansible_lint' -> ['ansible', 'ansible-lint']
  Enabled Linters: ['yaml-language-server', 'spectral', 'yamllint', 'ansible-language-server', 'ansible_lint']
  Ignored Linters: []
 Suggested Fixers: 
  'prettier' - Apply prettier to a file.
  '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.
  'yamlfix' - Fix yaml files with yamlfix.
 Linter Variables:

let g:ale_ansible_ansible_lint_executable = 'ansible-lint'
let g:ale_ansible_language_server_config = {}
let g:ale_ansible_language_server_executable = 'ansible-language-server'
let g:ale_yaml_ls_config = {}
let g:ale_yaml_ls_executable = 'yaml-language-server'
let g:ale_yaml_ls_use_global = 0
let g:ale_yaml_spectral_executable = 'spectral'
let g:ale_yaml_spectral_use_global = 0
let g:ale_yaml_yamllint_executable = 'yamllint'
let g:ale_yaml_yamllint_options = ''
 Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
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 = '%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_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 = {}
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 = -1
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 = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
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
 LSP Error Messages:

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

(executable check - failure) yaml-language-server
(executable check - failure) spectral
(executable check - failure) yamllint
(executable check - failure) ansible-lint
SkrrtBacharach commented 1 year ago

I did some print statement debugging and found the data that is passed which seems to cause this error:

{'cwd': v:null, '_deferred_job_id': 9, 'executable': 'ansible-lint', 'command': '%e --version'}

Unfortunately, I don't have the modified code with the print statement anymore. I'll try recreating it in the next few days.

hsanson commented 1 year ago

Possibly related to https://github.com/dense-analysis/ale/issues/4303 and https://github.com/dense-analysis/ale/issues/3956#issuecomment-1363093148

If you have lint on save enabled and you exit with :wq it will result in ALE triggering fixers that most likely will be active while the editor is exiting, therefore causing the error.