dense-analysis / ale

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

Linting results delayed when there are no moving elements in gVim's gui #515

Closed markonm closed 7 years ago

markonm commented 7 years ago

When I disable cursor and toolbar animations and use linting on save, linting results are delayed. Delay is sometimes longer than 5 seconds.

Linting results are reported immediately when I move cursor.

I'm using Windows 10 and this bug is present only in gVim 8.

I encountered similar bug in other plugins which use async features (neomake, NCM) .

I suppose this is strictly speaking Vim's bug, but I've been unable to compose minimal reproducible case which I could use to report directly to Vim.

Examples

I'm using jshint.

gui without moving parts long delay b gui with moving parts (blinking cursor, copy to clipboard icon) small delay a

Minimal vimrc

call plug#begin()
Plug 'w0rp/ale'
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_enter = 0
let g:ale_lint_on_save = 1
call plug#end()

se guioptions=
set guicursor=a:blinkon0

ALEInfo

 Current Filetype: javascript
Available Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
  Enabled Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
 Linter Variables:

let g:ale_javascript_eslint_executable = 'eslint'
let g:ale_javascript_eslint_options = ''
let g:ale_javascript_eslint_use_global = 0
let g:ale_javascript_flow_executable = 'flow'
let g:ale_javascript_flow_use_global = 0
let g:ale_javascript_jshint_executable = 'jshint'
let g:ale_javascript_jshint_use_global = 0
let g:ale_javascript_standard_executable = 'standard'
let g:ale_javascript_standard_options = ''
let g:ale_javascript_standard_use_global = 0
let g:ale_javascript_xo_executable = 'xo'
let g:ale_javascript_xo_options = ''
let g:ale_javascript_xo_use_global = 0
 Global Variables:

let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 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_save = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_open_list = 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_offset = 1000000
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(finished - exit code 0) 'cmd /c jshint --reporter unix --extract auto --config C:\Users\Marko\.jshintrc - < C:\Users\Marko\AppData\Local\Temp\VIAAC5E.tmp\a.js'

:version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 21 2017 22:02:21)
MS-Windows 64-bit GUI version with OLE support
Included patches: 1-577
Compiled by appveyor@APPVYR-WIN
Huge version with GUI.  Features included (+) or not (-):
+acl                +eval               +mouse              +syntax
+arabic             +ex_extra           +mouseshape         +tag_binary
+autocmd            +extra_search       +multi_byte_ime/dyn +tag_old_static
+balloon_eval       +farsi              +multi_lang         -tag_any_white
+browse             +file_in_path       +mzscheme/dyn       +tcl/dyn
++builtin_terms     +find_in_path       +netbeans_intg      -termguicolors
+byte_offset        +float              +num64              -tgetent
+channel            +folding            +ole                -termresponse
+cindent            -footer             +packages           +textobjects
+clientserver       +gettext/dyn        +path_extra         +timers
+clipboard          -hangul_input       +perl/dyn           +title
+cmdline_compl      +iconv/dyn          +persistent_undo    +toolbar
+cmdline_hist       +insert_expand      -postscript         +user_commands
+cmdline_info       +job                +printer            +vertsplit
+comments           +jumplist           +profile            +virtualedit
+conceal            +keymap             +python/dyn         +visual
+cryptv             +lambda             +python3/dyn        +visualextra
+cscope             +langmap            +quickfix           +viminfo
+cursorbind         +libcall            +reltime            +vreplace
+cursorshape        +linebreak          +rightleft          +wildignore
+dialog_con_gui     +lispindent         +ruby/dyn           +wildmenu
+diff               +listcmds           +scrollbind         +windows
+digraphs           +localmap           +signs              +writebackup
+directx            +lua/dyn            +smartindent        -xfontset
-dnd                +menu               +startuptime        -xim
-ebcdic             +mksession          +statusline         +xpm_w32
+emacs_tags         +modify_fname       -sun_workshop       -xterm_save
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$HOME\vimfiles\vimrc"
 3rd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIM\gvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
       defaults file: "$VIMRUNTIME\defaults.vim"
    system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL   -DFEAT_XPM_W32   -DWINVER=0x500 -D_WIN32_WINNT=0x500  /Fo.\ObjGXOULYHTRZAMD64/ /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG  /Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_MBYTE -DFEAT_GUI_W32 -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl86.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python35.dll\" -DFEAT_MZSCHEME -I "C:\Program Files\Racket\include" -DMZ_PRECISE_GC -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libracket3m_a0solc.dll\" -DDYNAMIC_MZGC_DLL=\"libracket3m_a0solc.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl524.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=22 -DDYNAMIC_RUBY_DLL=\"x64-msvcrt-ruby220.dll\" -DFEAT_HUGE /Fd.\ObjGXOULYHTRZAMD64/ /Zi
Linking: link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib uuid.lib /machine:AMD64 gdi32.lib version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib  /machine:AMD64 /nodefaultlib libcmt.lib oleaut32.lib user32.lib  /nodefaultlib:lua53.lib  /STACK:8388608  /nodefaultlib:python27.lib /nodefaultlib:python35.lib   "C:\Tcl\lib\tclstub86.lib" WSock32.lib xpm\x64\lib\libXpm.lib /PDB:gvim.pdb -debug
w0rp commented 7 years ago

Could you log some profiler results for each case? http://stackoverflow.com/a/12216578/1836507

Maybe by looking at the profile, we can see where the lag comes in. It might be something internal to Vim, as you say.

markonm commented 7 years ago

I can't see any difference in profile results. It seems as vim receives linter's results at the same time, but for some reason doesn't update gui when there are no moving elements present.

slow.txt fast.txt slow2.txt fast2.txt slow3.txt fast3.txt

This snippet provided by @roxma somehow forces gui to react. The workaround solves the issue but causes some other problems.

func g:Foo(...)
" do nothing
endfunc
call timer_start(100,function('g:Foo'),{'repeat':-1})
w0rp commented 7 years ago

I guess it's a GVim bug, then.

markonm commented 7 years ago

This commit fixed the issue.

When I set g:ale_set_balloons to 0 results are still delayed, though.

w0rp commented 7 years ago

Maybe setting balloonexpr causes GVim to redraw the window. If this has been fixed now, I'll close this issue.