dense-analysis / ale

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

ALE overwrite the python-mode linter Location List #3994

Open Felixoid opened 3 years ago

Felixoid commented 3 years ago

Information

VIM version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 09 2021 19:35:34)
Included patches: 1-3582

Operating System:

Updated arch linux

What went wrong

Here's my minimal vimrc to reproduce the bug:

silent! call plug#begin()
Plug 'dense-analysis/ale'
Plug 'python-mode/python-mode', { 'branch': 'develop' }
call plug#end()

" pymode
let g:pymode_rope = 0 " using YouCompleteMe instead of rope
let g:pymode_lint = 1
let g:pymode_lint_unmodified = 1
au FileType python setlocal wrap

After installing the pluggins with vim-plug, ALE refresh the output of PymodeLint Location List. Here is the link with screencast

Reproducing the bug

  1. Use the vimrc from above
  2. Try to save any python file

:ALEInfo

 Current Filetype: python
Available Linters: ['bandit', 'cspell', 'flake8', 'flakehell', 'jedils', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pylsp', 'pyre', 'pyright', 'vulture']
  Enabled Linters: ['flake8', 'mypy', 'pylint', 'pyright']
  Ignored Linters: []
 Suggested Fixers: 
  'add_blank_lines_for_python_control_statements' - Add blank lines before control statements.
  'autoflake' - Fix flake issues with autoflake.
  'autoimport' - Fix import issues with autoimport.
  'autopep8' - Fix PEP8 issues with autopep8.
  'black' - Fix PEP8 issues with black.
  'isort' - Sort Python imports with isort.
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'reorder-python-imports' - Sort Python imports with reorder-python-imports.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
  'yapf' - Fix Python files with yapf.
 Linter Variables:

let g:ale_python_auto_pipenv = 0
let g:ale_python_auto_poetry = 0
let g:ale_python_flake8_auto_pipenv = 0
let g:ale_python_flake8_auto_poetry = 0
let g:ale_python_flake8_change_directory = 'project'
let g:ale_python_flake8_executable = 'flake8'
let g:ale_python_flake8_options = ''
let g:ale_python_flake8_use_global = 0
let g:ale_python_mypy_auto_pipenv = 0
let g:ale_python_mypy_auto_poetry = 0
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_ignore_invalid_syntax = 0
let g:ale_python_mypy_options = ''
let g:ale_python_mypy_show_notes = 1
let g:ale_python_mypy_use_global = 0
let g:ale_python_pylint_auto_pipenv = 0
let g:ale_python_pylint_auto_poetry = 0
let g:ale_python_pylint_change_directory = 1
let g:ale_python_pylint_executable = 'pylint'
let g:ale_python_pylint_options = ''
let g:ale_python_pylint_use_global = 0
let g:ale_python_pylint_use_msg_id = 0
let g:ale_python_pyright_config = {}
let g:ale_python_pyright_executable = 'pyright-langserver'
 Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
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 = 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_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(finished - exit code 127) ['/bin/zsh', '-c', '''pylint'' --version']

<<<OUTPUT STARTS>>>
zsh:1: command not found: pylint
<<<OUTPUT ENDS>>>

(executable check - failure) flake8
(executable check - failure) mypy
(executable check - failure) pylint
(executable check - failure) pyright-langserver

I see the let g:ale_lint_on_save = 1 is set, althoug I'd like to see it autoconfigured based on g:pymode_lint

If it's overcomplicated, at lease other persons maybe will find the solution quickly next time.

upd On another hand, why ALE at all touch Location List, it it doesn't do anything with it? Isn't it better to not bother itself with touching it?

hsanson commented 2 years ago

If you set g:ale_set_loclist to zero then ALE won't touch the loclist. Similarly setting g:ale_set_quickfix tells ALE not to touch the quickfix.

Felixoid commented 2 years ago

Thank you, I know a workaround. Although, I'd like to have a general solution.

w0rp commented 1 year ago

The python-mode plugin could be updated to write to the loclist with its own ID instead of replacing the contents of loclist. Each plugin can effectively maintain its own sublist, and ALE should be doing that.