From 74266d8106abc58412a48bd53990ef2b172a99f3 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sun, 26 Oct 2025 19:35:25 +0900 Subject: [PATCH 1/2] Fix denops#cache#update() Use loop --- autoload/denops/cache.vim | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/autoload/denops/cache.vim b/autoload/denops/cache.vim index ebe13953..20c652c4 100644 --- a/autoload/denops/cache.vim +++ b/autoload/denops/cache.vim @@ -5,31 +5,31 @@ let s:job = v:null function! denops#cache#update(...) abort const l:options = extend(#{ reload: v:false }, a:0 ? a:1 : {}) const l:plugins = denops#_internal#plugin#list() - const l:entryfiles = extend([s:mod], mapnew(l:plugins, { _, v -> v.script })) - let l:args = [g:denops#deno, 'cache'] - - if l:options.reload - let l:args = add(l:args, '--reload') - echomsg '[denops] Forcibly update cache of the following files.' - else + if !l:options.reload echomsg '[denops] Update cache of the following files. Call `denops#cache#update(#{reload: v:true})` to forcibly update.' endif - for l:entryfile in l:entryfiles + for l:entryfile in [s:mod] + mapnew(l:plugins, { _, v -> v.script }) echomsg printf('[denops] %s', l:entryfile) + + let l:args = [g:denops#deno, 'cache'] + if l:options.reload + let l:args = add(l:args, '--reload') + endif + let l:args = add(l:args, l:entryfile) + + let s:job = denops#_internal#job#start(l:args, #{ + \ on_stderr: funcref('s:on_stderr'), + \ on_exit: funcref('s:on_exit'), + \ env: #{ + \ NO_COLOR: 1, + \ DENO_NO_PROMPT: 1, + \ }, + \}) + call denops#_internal#wait#for(60 * 1000, { -> s:job is# v:null }, 100) endfor - let l:args = extend(l:args, l:entryfiles) - - let s:job = denops#_internal#job#start(l:args, #{ - \ on_stderr: funcref('s:on_stderr'), - \ on_exit: funcref('s:on_exit'), - \ env: #{ - \ NO_COLOR: 1, - \ DENO_NO_PROMPT: 1, - \ }, - \}) - call denops#_internal#wait#for(60 * 1000, { -> s:job is# v:null }, 100) + echomsg '[denops] Deno cache is updated.' endfunction From 60709f4b415e3fdcb4472a2fb9b120b81f2f5ffa Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sun, 26 Oct 2025 20:00:35 +0900 Subject: [PATCH 2/2] Fix for review --- autoload/denops/cache.vim | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/autoload/denops/cache.vim b/autoload/denops/cache.vim index 20c652c4..74bc9d2b 100644 --- a/autoload/denops/cache.vim +++ b/autoload/denops/cache.vim @@ -5,6 +5,7 @@ let s:job = v:null function! denops#cache#update(...) abort const l:options = extend(#{ reload: v:false }, a:0 ? a:1 : {}) const l:plugins = denops#_internal#plugin#list() + let l:failures = [] if !l:options.reload echomsg '[denops] Update cache of the following files. Call `denops#cache#update(#{reload: v:true})` to forcibly update.' @@ -21,7 +22,7 @@ function! denops#cache#update(...) abort let s:job = denops#_internal#job#start(l:args, #{ \ on_stderr: funcref('s:on_stderr'), - \ on_exit: funcref('s:on_exit'), + \ on_exit: funcref('s:on_exit', [l:failures, l:entryfile]), \ env: #{ \ NO_COLOR: 1, \ DENO_NO_PROMPT: 1, @@ -30,7 +31,16 @@ function! denops#cache#update(...) abort call denops#_internal#wait#for(60 * 1000, { -> s:job is# v:null }, 100) endfor - echomsg '[denops] Deno cache is updated.' + if empty(l:failures) + echomsg '[denops] Deno cache is updated.' + else + echohl WarningMsg + echomsg printf('[denops] Deno cache finished with errors: %d failure(s).', len(l:failures)) + for l:f in l:failures + echomsg printf('[denops] failed: %s', l:f) + endfor + echohl None + endif endfunction function! s:on_stderr(job, data, event) abort @@ -41,6 +51,9 @@ function! s:on_stderr(job, data, event) abort echohl None endfunction -function! s:on_exit(job, status, event) abort +function! s:on_exit(failures, entryfile, job, status, event) abort + if a:status != 0 + call add(a:failures, a:entryfile) + endif let s:job = v:null endfunction