From 920942239d2506cd48fde575da65b16742f6f575 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 15 Jun 2026 21:28:28 -0400 Subject: fix: vim.fn.readdir changed to vim.loop_fs_scandir --- lua/denote-fzf-lua.lua | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'lua') diff --git a/lua/denote-fzf-lua.lua b/lua/denote-fzf-lua.lua index 508730e..c2999bb 100644 --- a/lua/denote-fzf-lua.lua +++ b/lua/denote-fzf-lua.lua @@ -12,17 +12,16 @@ local function list_denote_files(dir) while #stack > 0 do local current = table.remove(stack) - local ok, entries = pcall(vim.fn.readdir, current) - if ok then - for _, entry in ipairs(entries) do - local full = current .. "/" .. entry - local stat = vim.loop.fs_stat(full) - if stat then - if stat.type == "directory" then - table.insert(stack, full) - elseif stat.type == "file" and entry:match("^%d%d%d%d%d%d%d%dT%d%d%d%d%d%d") then - table.insert(results, full) - end + local ok, handle = pcall(vim.loop.fs_scandir, current) + if ok and handle then + while true do + local name, typ = vim.loop.fs_scandir_next(handle) + if not name then break end + local full = current .. "/" .. name + if typ == "directory" then + table.insert(stack, full) + elseif (typ == "file" or typ == "link") and name:match("^%d%d%d%d%d%d%d%dT%d%d%d%d%d%d") then + table.insert(results, full) end end end @@ -168,6 +167,10 @@ end function M.search_files(options) local files = list_denote_files(options.dir) + if #files == 0 then + vim.notify("denote-fzf-lua: no Denote files found in " .. options.dir, vim.log.levels.WARN) + return + end local lines = format_denote_table(files) local opts = {} -- cgit v1.2.3