diff --git a/autoload/fern/internal/node.vim b/autoload/fern/internal/node.vim index be2f9db..1fe1203 100644 --- a/autoload/fern/internal/node.vim +++ b/autoload/fern/internal/node.vim @@ -60,7 +60,9 @@ function! fern#internal#node#parent(node, provider, token, ...) abort endif let l:Profile = fern#profile#start('fern#internal#node#parent') let l:Done = fern#internal#node#process(a:node) - let p = a:provider.get_parent(a:node, a:token) + let p = s:Promise.new({ resolve -> + \ resolve(a:provider.get_parent(a:node, a:token)) + \ }) \.then({ n -> s:new(n, { \ '__key': [], \ '__owner': v:null, @@ -91,7 +93,9 @@ function! fern#internal#node#children(node, provider, token, ...) abort endif let l:Profile = fern#profile#start('fern#internal#node#children') let l:Done = fern#internal#node#process(a:node) - let p = a:provider.get_children(a:node, a:token) + let p = s:Promise.new({ resolve -> + \ resolve(a:provider.get_children(a:node, a:token)) + \ }) \.then(s:AsyncLambda.map_f({ n -> \ s:new(n, { \ '__key': a:node.__key + [n.name], diff --git a/autoload/fern/scheme/file/util.vim b/autoload/fern/scheme/file/util.vim index e0d139b..a1912bf 100644 --- a/autoload/fern/scheme/file/util.vim +++ b/autoload/fern/scheme/file/util.vim @@ -37,7 +37,8 @@ if exists('*readdir') let l:Profile = fern#profile#start('fern#scheme#file#util#list_entries_readdir') let s = s:is_windows ? '\' : '/' let p = a:path[-1:] ==# s ? a:path : (a:path . s) - return s:Promise.resolve(readdir(a:path)) + silent! let children = readdir(a:path) + return s:Promise.resolve(children) \.then(s:AsyncLambda.map_f({ v -> p . v })) \.finally({ -> Profile() }) endfunction