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

Linting with lint on insert leave enabled #2868

Open bazzb opened 5 years ago

bazzb commented 5 years ago

Information

VIM version

NVIM v0.3.8 Build type: RelWithDebInfo

Operating System: Fedora

What went wrong

ALE is linting the file while in insert mode with let g:ale_lint_on_insert_leave = 1

Reproducing the bug

  1. enable completion ( let g:ale_completion_enabled = 1 )
  2. start editing code, if a suggestion comes up it will lint the file and point out errors

: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 = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = 100 let g:ale_completion_enabled = 1 let g:ale_completion_max_suggestions = 50 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 = {'rust': ['rustfmt']} 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 = {'rust': ['rls']} 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 = 0 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) rls (started) ['/bin/bash', '-c', '''rls''']

vnetserg commented 5 years ago

What a coincidence, I just wanted to report the same bug! To maybe give a more complete configuration:

let g:ale_lint_on_text_changed = 0                                                                  
let g:ale_lint_on_save = 1                                                                          
let g:ale_lint_on_insert_leave = 0                                                                  
let g:ale_completion_enabled = 1

But ale still lints every time autocompletion shows up :( Setting let g:ale_completion_enabled = 0 solves the issue. Would be cool to use ale completion though!

toupeira commented 4 years ago

It seems this is related to LSP, I ran into this as well after I started using bash-language-server.

I'm using ALE with Deoplete and these defaults:

let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_text_changed = 'normal'

If an LSP is active, linting isn't updated in insert mode. If an LSP is active, linting is updated when auto-completion is triggered, but only for the LSP linters.

ghost commented 4 years ago

I am experiencing this not only with auto-complete but with any of the functions that call ale#lsp#NotifyForChanges.

I'm not 100% sure but could it be caused by ale#lsp#NotifyForChanges triggering the language server to send a diagnostic message on the changed document?