Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language servers and |ale_lint_on_text_changed| #3105

Closed
mversic opened this issue Apr 13, 2020 · 8 comments
Closed

Language servers and |ale_lint_on_text_changed| #3105

mversic opened this issue Apr 13, 2020 · 8 comments
Labels

Comments

@mversic
Copy link

mversic commented Apr 13, 2020

Information

VIM version
NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5

Operating System:
Manjaro 19.0.2 Kyria

What went wrong

When ale_lint_on_text_changed=never ALE shouldn't lint while I am inserting which it doesn't unless I have ALE configured with some language server. I've tried using rls and pyls, it happened for both.
As far as I can determine, with language servers used, ALE bahaves as if ale_lint_on_text_changed=insert was set even when it's set to never.

Reproducing the bug

  1. enable LS for some language
  2. set ale_lint_on_text_changed=never
  3. open a document and start typing randomly
  4. observe how linting is being done even though it shouldn't be

:ALEInfo

Current Filetype: rust
Available Linters: ['cargo', 'rls', 'rustc']
Enabled Linters: ['rls']
Suggested Fixers:
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'rustfmt' - Fix Rust files with Rustfmt.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:

let g:ale_rust_rls_config = {}
let g:ale_rust_rls_executable = 'rls'
let g:ale_rust_rls_toolchain = ''
Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 1
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_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 = v:null
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 = {'rust': ['rls'], 'python': ['pyls']}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = v:null
let g:ale_list_window_size = v:null
let g:ale_loclist_msg_format = v:null
let g:ale_lsp_root = {}
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 = v:null
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
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_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:

(executable check - success) rls
(started) ['/usr/bin/zsh', '-c', '''rls''''']'''']
@mversic mversic added the bug label Apr 13, 2020
@mversic
Copy link
Author

mversic commented Apr 21, 2020

what should be the default value ale_lint_on_text_changed=normal is not working as well

@jasoncoleusa
Copy link

jasoncoleusa commented Apr 21, 2020

I am trying to setup ale for the first time today and am having issues getting lint_on_text_changed='never' to work.

ALEInfo

 Current Filetype: python
Available Linters: ['bandit', 'flake8', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pyls', 'pyre', 'vulture']
  Enabled Linters: ['flake8', 'mypy', 'pylint']
 Suggested Fixers:
  'add_blank_lines_for_python_control_statements' - Add blank lines before control statements.
  '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_flake8_auto_pipenv = 0
let g:ale_python_flake8_change_directory = 1
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_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_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
 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_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 = 0
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_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
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 = 1
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
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:
(executable check - success) flake8
(finished - exit code 0) ['/bin/bash', '-c', '''flake8'' --version']
<<<OUTPUT STARTS>>>
3.7.9 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.7.7 on Darwin
<<<OUTPUT ENDS>>>
(executable check - failure) mypy
(finished - exit code 1) ['/bin/bash', '-c', 'cd ''/Users/jcole'' && ''flake8'' --format=default --stdin-display-name ''/Users/jcole/test.py'' - < ''/var/folders/db/ktk_lw4x6m76dbswxxls41sc0000gn/T/vgM5clw/1/test.py''']
<<<OUTPUT STARTS>>>
/Users/jcole/test.py:2:1: F821 undefined name 'a'
/Users/jcole/test.py:2:2: W291 trailing whitespace
/Users/jcole/test.py:4:1: E402 module level import not at top of file
/Users/jcole/test.py:4:1: F401 'time' imported but unused
/Users/jcole/test.py:6:1: E302 expected 2 blank lines, found 1
/Users/jcole/test.py:8:5: F841 local variable 'x' is assigned to but never used
/Users/jcole/test.py:14:5: F821 undefined name 'retun'
/Users/jcole/test.py:15:1: W391 blank line at end of file
<<<OUTPUT ENDS>>>

VIM

:version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 18 2020 18:46:04)
macOS version
Included patches: 1-400
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               ++builtin_terms    +cmdline_info      +diff              -farsi             -hangul_input      +libcall           +modify_fname      -mouse_sysmouse    +packages          -python            +smartindent       -tag_old_static    +textprop          +visual            -X11
+arabic            +byte_offset       +comments          +digraphs          +file_in_path      +iconv             +linebreak         +mouse             +mouse_urxvt       +path_extra        +python3           -sound             -tag_any_white     +timers            +visualextra       -xfontset
+autocmd           +channel           +conceal           -dnd               +find_in_path      +insert_expand     +lispindent        -mouseshape        +mouse_xterm       +perl              +quickfix          +spell             -tcl               +title             +viminfo           -xim
+autochdir         +cindent           +cryptv            -ebcdic            +float             +job               +listcmds          +mouse_dec         +multi_byte        +persistent_undo   +reltime           +startuptime       +termguicolors     -toolbar           +vreplace          -xpm
-autoservername    -clientserver      +cscope            +emacs_tags        +folding           +jumplist          +localmap          -mouse_gpm         +multi_lang        +popupwin          +rightleft         +statusline        +terminal          +user_commands     +wildignore        -xsmp
-balloon_eval      +clipboard         +cursorbind        +eval              -footer            +keymap            +lua               -mouse_jsbterm     -mzscheme          +postscript        +ruby              -sun_workshop      +terminfo          +vartabs           +wildmenu          -xterm_clipboard
+balloon_eval_term +cmdline_compl     +cursorshape       +ex_extra          +fork()            +lambda            +menu              +mouse_netterm     +netbeans_intg     +printer           +scrollbind        +syntax            +termresponse      +vertsplit         +windows           -xterm_save
-browse            +cmdline_hist      +dialog_con        +extra_search      +gettext           +langmap           +mksession         +mouse_sgr         +num64             +profile           +signs             +tag_binary        +textobjects       +virtualedit       +writebackup
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.15 -fstack-protector-strong -
L/usr/local/lib  -L/usr/local/Cellar/perl/5.30.1/lib/perl5/5.30.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation  -lruby.2.7

@jasoncoleusa
Copy link

I ended up adding this and behaves like I was hoping. Not sure what the difference is between these variables...

let g:ale_lint_on_insert_leave = 0

@mversic
Copy link
Author

mversic commented Apr 21, 2020

@jasontcole if you are not using a language server, and it seems you don't, then your problem is unrelated to this issue

@copy
Copy link

copy commented May 30, 2020

I also have this issue with ALE and rls. The issue goes away when automatic completion popups are disabled (e.g., let g:ale_completion_enabled = 0 and deoplete is disabled). I suspect rls responds with a list of errors when ALE asks it for completion, and ALE fills the error list with this info even though ale_lint_on_text_changed=never is set.

@w0rp
Copy link
Member

w0rp commented Aug 29, 2020

It is not possible to fix this without changing Language Server Protocol itself. See this issue I filed a while ago: microsoft/language-server-protocol#737

@w0rp w0rp closed this as completed Aug 29, 2020
@copy
Copy link

copy commented Sep 19, 2020

@w0rp I don't see this being fixed upstream any time soon. In the mean time, could ALE buffer diagnostic responses when in insert mode?

@w0rp
Copy link
Member

w0rp commented Sep 20, 2020

No, the LSP standard should be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants