Skip to content

Commit b648ed2

Browse files
committed
Fix denops#cache#update()
Use loop
1 parent a278b83 commit b648ed2

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

autoload/denops/cache.vim

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ let s:job = v:null
55
function! denops#cache#update(...) abort
66
const l:options = extend(#{ reload: v:false }, a:0 ? a:1 : {})
77
const l:plugins = denops#_internal#plugin#list()
8-
const l:entryfiles = extend([s:mod], map(copy(l:plugins), { _, v -> v.script }))
98

10-
let l:args = [g:denops#deno, 'cache']
11-
12-
if l:options.reload
13-
let l:args = add(l:args, '--reload')
14-
echomsg '[denops] Forcibly update cache of the following files.'
15-
else
9+
if !l:options.reload
1610
echomsg '[denops] Update cache of the following files. Call `denops#cache#update(#{reload: v:true})` to forcibly update.'
1711
endif
1812

19-
for l:entryfile in l:entryfiles
13+
for l:entryfile in [s:mod] + map(copy(l:plugins), { _, v -> v.script })
2014
echomsg printf('[denops] %s', l:entryfile)
15+
16+
let l:args = [g:denops#deno, 'cache']
17+
if l:options.reload
18+
let l:args = add(l:args, '--reload')
19+
endif
20+
let l:args = add(l:args, l:entryfile)
21+
22+
let s:job = denops#_internal#job#start(l:args, #{
23+
\ on_stderr: funcref('s:on_stderr'),
24+
\ on_exit: funcref('s:on_exit'),
25+
\ env: #{
26+
\ NO_COLOR: 1,
27+
\ DENO_NO_PROMPT: 1,
28+
\ },
29+
\})
30+
call denops#_internal#wait#for(60 * 1000, { -> s:job is# v:null }, 100)
2131
endfor
22-
let l:args = extend(l:args, l:entryfiles)
23-
24-
let s:job = denops#_internal#job#start(l:args, #{
25-
\ on_stderr: funcref('s:on_stderr'),
26-
\ on_exit: funcref('s:on_exit'),
27-
\ env: #{
28-
\ NO_COLOR: 1,
29-
\ DENO_NO_PROMPT: 1,
30-
\ },
31-
\})
32-
call denops#_internal#wait#for(60 * 1000, { -> s:job is# v:null }, 100)
32+
3333
echomsg '[denops] Deno cache is updated.'
3434
endfunction
3535

0 commit comments

Comments
 (0)