1
+ const s: DELAYED_INTERVAL = 100
2
+
3
+ let s: delayed_messages = []
4
+ let s: delayed_timer = 0
5
+
1
6
function ! denops#_internal#echo#deprecate (... ) abort
2
7
if g: denops #disable_deprecation_warning_message
3
8
return
@@ -17,15 +22,15 @@ function! denops#_internal#echo#debug(...) abort
17
22
endfunction
18
23
19
24
function ! denops#_internal#echo#info (... ) abort
20
- call s: echomsg (' Title' , a: 000 )
25
+ call s: echomsg_delay (' Title' , a: 000 )
21
26
endfunction
22
27
23
28
function ! denops#_internal#echo#warn (... ) abort
24
- call s: echomsg (' WarningMsg' , a: 000 )
29
+ call s: echomsg_delay (' WarningMsg' , a: 000 )
25
30
endfunction
26
31
27
32
function ! denops#_internal#echo#error (... ) abort
28
- call s: echomsg (' ErrorMsg' , a: 000 )
33
+ call s: echomsg_delay (' ErrorMsg' , a: 000 )
29
34
endfunction
30
35
31
36
function ! s: echomsg (hl , msg) abort
@@ -35,3 +40,21 @@ function! s:echomsg(hl, msg) abort
35
40
endfor
36
41
echohl None
37
42
endfunction
43
+
44
+ function ! s: echomsg_delay (hl , msg) abort
45
+ call add (s: delayed_messages , [a: hl , a: msg ])
46
+ call timer_stop (s: delayed_timer )
47
+ let s: delayed_timer = timer_start (s: DELAYED_INTERVAL , {- > s: echomsg_batch ()})
48
+ endfunction
49
+
50
+ function ! s: echomsg_batch () abort
51
+ let l: counter = 0
52
+ for l: message in s: delayed_messages
53
+ call s: echomsg (l: message [0 ], l: message [1 ])
54
+ let l: counter += len (split (join (l: message [1 ]), ' \n' ))
55
+ endfor
56
+ let s: delayed_timer = 0
57
+ let s: delayed_messages = []
58
+ " Forcibly show the messages to the user
59
+ call feedkeys (printf (" \<Cmd> %dmessages\<CR> " , l: counter ), ' n' )
60
+ endfunction
0 commit comments