Closed jsfr closed 5 years ago
Do you know the way to reproduce this? I'm also ALE user, and I think I saw the same error once. But I could not reproduce it.
ALE outputs some messages asynchronously. And clever-f waits an input from user by getchar()
. So, this issue may occur because ALE echoes some text while waiting user's input with getchar()
.
I haven't been able to find the exact set of actions to reproduce this. It seems to happen semi-randomly. I think I've seen it happen more often when I'm on a "roll" in terms of moving fast between edits and movement using f
or t
.
Yeah, it's a timing issue... When editing fast, ALE runs linter multiple times and it shows the results to message area. At the same time, when hitting f
or t
and it leads to calling getchar()
, this error looks to appear.
I tried some script to reproduce this referring TruncatedEcho()
function in ALE, but I couldn't. More investigation is necessary..
" Simple version of TruncatedEcho()
function! s:say_hello(_) abort
let l:message = 'HELLO'
let l:shortmess_options = &l:shortmess
try
setlocal shortmess+=T
exec "norm! :echomsg l:message\n"
call setpos('.', s:cursor_position)
finally
let &l:shortmess = l:shortmess_options
endtry
endfunction
let s:cursor_position = getcurpos()
call timer_start(1000, function('s:say_hello'))
call getchar()
I think this error occurs here:
https://github.com/vim/vim/blob/b9464821901623f983528acaed9e4dc2cea7387b/src/normal.c#L799
It means:
:normal
command. Actually TruncatedEcho
uses :norm!
command.:normal
command shows the error message (text_locked_msg()
does) when it is executed while editing cmdline. (clever-f gets user's input via cmdline using getchar()
)I have no idea why I cannot reproduce this problem by above script, but TruncatedEcho
may need to be modified not to use :normal
.
I'm seeing a similar issue all the time; also an ALE user:
Error detected while processing function clever_f#find_with[31]..<SNR>141_getchar:
line 2:
E170: Missing :endwhile
@kmhofmann Is it the entire error message? The message is different from one @jsfr and I saw.
@rhysd Yep, that is the entire error message. I do see this often enough to be a bit annoying (every few minutes in a coding session), and it seems that disabling ALE makes this disappear. It's difficult to prove or to reproduce, though. The following ALE linters are enabled when this happens: clang, clangtidy, g++.
@kmhofmann Thanks. Error I saw occurred when using f
/t
just after saving the buffer. How about you? And if you're ok, could you show your ALE configuration? Frequency looks different from me.
Hi @rhysd - sure! The error can occur any time when editing; I did not notice any increased frequency around saving or any other action.
My base configuration: https://github.com/kmhofmann/dotfiles/blob/07c0c8df75b5077edab4258a93c91948b5ca719b/.vimrc#L715 And some extra project specific configuration on top: https://github.com/kmhofmann/selene/blob/062cb0a6a05a516a9b8d9a0cc3e779c181be3295/.lvimrc
@kmhofmann Thank you for the info. It looks your configuration is more aggressive than mine (I only run linters/fixers on saving a buffer). So I think frequency of running linters/fixiers is high.
This issue seems to occur when clever-f waits user input with getchar()
and at the same moment ALE echoes some messages. So higher frequency of running linters would cause this issue more often.
Let me perform more investigation for this issue (actually I also feel this is annoying).
I could also reproduce the error without clever-f.vim:
Error detected while processing function <SNR>184_VimCloseCallback[11]..<SNR>184_VimExitCallback[14]..<SNR>179_HandleExit[50]..ale#engine#Han
dleLoclist[33]..ale#engine#SetResults[26]..ale#cursor#EchoCursorWarning[22]..ale#cursor#TruncatedEcho:
line 15:
E523: Not allowed here
Error detected while processing function <SNR>184_VimCloseCallback:
line 11:
E171: Missing :endif
with mapping nnoremap <silent><expr>m 'i'.nr2char(getchar())."\<Esc>"
This issue should be fixed by https://github.com/w0rp/ale/pull/1987. Please update ALE to the latest. If you still see this issue, please let me know by commenting here.
i dont use ale but i just got this error using coc. any way how i can fix this or notify maintainers of coc what the error actually is? i know 0 of vim script :(
its weird because im not even using clever f features.. im just doing delete til motions..
I'm getting this error occasionally when using clever-f. It seems to be related to https://github.com/w0rp/ale but I'm not really sure what the error is trying to tell me nor whether the issue is with clever-f or ale.
Any help would be greatly appreciated 🙏