ale
ale copied to clipboard
ALE causes cursor move irregularly when Pmenu is visible in GVim
When I just start to use ALE recently, it works great, but when I am using ALE with YouCompleteMe together, I find two issues here:
- when I type something with Pmenu visible, the cursor will move away from its origin position and stay on the right edge of the completion Pmenu for nearly one second, then the cursor will move back again. See the GIF below:

- ALE causes Pmenu flicker (refresh frequently), especially when Pmenu has more than 5 items. See the GIF below:

This is very annoying. I just can't use them together in GVim.
Information
VIM Version: 8.0.1704 (GVIM on windows)
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 12 2018 22:09:26)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-1704
Operating System: Windows 10
:ALEInfo
Current Filetype: lua
Available Linters: ['luac', 'luacheck']
Enabled Linters: ['luac']
Linter Variables:
let g:ale_lua_luac_executable = 'luac'
Global Variables:
let g:ale_cache_executable_check_failures = 0
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = 500
let g:ale_completion_enabled = 0
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 = '[%linter%] %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 = 500
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_lint_on_insert_leave = 0
let g:ale_linter_aliases = {}
let g:ale_linters = {'c': ['gcc', 'cppcheck'], 'lua': ['luac'], 'cpp': ['gcc', 'cppcheck'], 'python': ['flake8', 'pylint']}
let g:ale_linters_explicit = 1
let g:ale_list_window_size = 10
let g:ale_list_vertical = 0
let g:ale_loclist_msg_format = '[%linter%] %code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = 0
let g:ale_open_list = 0
let g:ale_pattern_options = {}
let g:ale_pattern_options_enabled = 0
let g:ale_set_balloons = 1
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_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(started) 'cmd /s/c "luac -p - < C:\Users\Linwei\AppData\Local\Temp\VIAFA46.tmp\test.lua"'
(finished - exit code 0) 'cmd /s/c "luac -p - < C:\Users\Linwei\AppData\Local\Temp\VIBFA76.tmp\test.lua"'
<<<NO OUTPUT RETURNED>>>
(finished - exit code 0) 'cmd /s/c "luac -p - < C:\Users\Linwei\AppData\Local\Temp\VIC90D.tmp\test.lua"'
<<<NO OUTPUT RETURNED>>>
(finished - exit code 1) 'cmd /s/c "luac -p - < C:\Users\Linwei\AppData\Local\Temp\VIDFC5.tmp\test.lua"'
<<<OUTPUT STARTS>>>
luac: stdin:11: syntax error near <eof>
<<<OUTPUT ENDS>>>
(finished - exit code 1) 'cmd /s/c "luac -p - < C:\Users\Linwei\AppData\Local\Temp\VIE136F.tmp\test.lua"'
<<<OUTPUT STARTS>>>
luac: stdin:11: syntax error near <eof>
<<<OUTPUT ENDS>>>
(finished - exit code 1) 'cmd /s/c "luac -p - < C:\Users\Linwei\AppData\Local\Temp\VIM4554.tmp\test.lua"'
<<<OUTPUT STARTS>>>
luac: stdin:11: syntax error near <eof>
<<<OUTPUT ENDS>>>
......
<<<NO OUTPUT RETURNED>>>
What went wrong
- when I type something with Pmenu visible, the cursor will move away from its origin position and stay on the right edge of the completion Pmenu for nearly one second, then the cursor will move back again.

- ALE causes Pmenu flicker (refresh frequently), especially when Pmenu has more than 5 items.

Reproducing the bug
Steps for repeating the bug:
- Enable YouCompleteMe and ALE in GVim on windows.
- Type something cause the completion popup menu display.
- Type one character.
I haven't looked into this yet, but my guess would be that YouCompleteMe updates the menu whenever b:changedtick is changed, and b:changedtick could be changed when calling any of the functions for displaying problems in Vim, like updating the loclist or something.
But YouCompleteMe is fine without ale. no irregular cursor movement and no flicker.
I'm sure it is. Read my comment again.
oh, sorry, missed something.
Is it possible to prevent calling functions when popup menu is visible ?
I'll have a look into this. I don't know what's causing this yet for sure. It may be possible to reduce the amount of flicking by only calling certain functions if something has changed, or maybe YouCompleteMe will need to be modified to flicker less.
Thanks, I temporarily set
let g:ale_lint_on_text_changed = 'normal'
And it makes me feel better, but a lot of users don't know this .
It appears that calling function in timers is not a problem, I have written a test to verify it.
let s:index = 0
function! MyTimer(tid)
echo "index: " . s:index
let s:index += 1
return ''
endfunc
if exists('s:tid')
call timer_stop(s:tid)
endif
let s:tid = timer_start(100, 'MyTimer', {'repeat': -1})
After starting this timer, I found Pmenu and cursor worked fine. no Pmenu flickers and no strange cursor movement
Does the flickering stop happening when you set g:ale_echo_cursor to 1?
g:ale_echo_cursor = 1 does not help, it still happens.
EDIT: do you mean to 0 ? the default value is 1, both 0 and 1 can't stop flickering.
Yeah, 0 sorry. Okay then, so it's not the cursor echoing stuff. I'll see if I can repeat the bug myself later and see if anything can be done about it.
I switched over from Syntastic, and ALE was causing flickers in Windows 10 gvim whenever I changed anything, and two flickers when I undid a change. Changing g:ale_lint_delay from default 200 to 500 corrects the problem. Interestingly, setting g:ale_lint_delay to 100 also corrects it.
@JohnTJohnston See :help ale-lint for more options. I use these options personally.
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
I have the same issue with deoplete. The cursor and the pop-up list flicker when ale is active.
It might be related to this bug in Vim, which has already been fixed: https://bugs.launchpad.net/ubuntu/+source/vim/+bug/1768026 The Debian/Ubuntu package managers are long overdue for fixing that package.
Which version of Vim are you using?
NVIM v0.3.5
Maybe someone who has this issue can try to debug it and fix it.
I switched from deoplete to coc. Works perfect with ale so far.
I've removed ALE's Deoplete code for now, until it can be fixed. I asked for some help on how to get the Deoplete source to work properly.
Sorry I can not help.