Skip to content

Commit

Permalink
fix(path): no items when file fails stat
Browse files Browse the repository at this point in the history
Closes #688
  • Loading branch information
Saghen committed Dec 21, 2024
1 parent e360828 commit 4218120
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/blink/cmp/sources/path/fs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ function fs.fs_stat_all(cwd, entries)
for _, entry in ipairs(entries) do
table.insert(
tasks,
async.task.new(function(resolve, reject)
async.task.new(function(resolve)
uv.fs_stat(cwd .. '/' .. entry.name, function(err, stat)
if err then return reject(err) end
if err then return resolve(nil) end
resolve({ name = entry.name, type = entry.type, stat = stat })
end)
end)
)
end
return async.task.await_all(tasks)
return async.task.await_all(tasks):map(function(entries)
return vim.tbl_filter(function(entry) return entry ~= nil end, entries)
end)
end

--- @param path string
Expand Down

0 comments on commit 4218120

Please sign in to comment.