Skip to content

Commit 909bffc

Browse files
committed
refactor: prefer vim.fs.find over plenary.scandir
1 parent f42762a commit 909bffc

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

lua/telescope/builtin/__internal.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,11 @@ internal.symbols = function(opts)
290290
end
291291
end)()
292292
if data_path:exists() then
293-
for _, v in ipairs(require("plenary.scandir").scan_dir(data_path:absolute(), { search_pattern = "%.json$" })) do
293+
for _, v in
294+
ipairs(vim.fs.find(function(name, _)
295+
return name:match "%.json$"
296+
end, { path = data_path:absolute(), limit = math.huge, type = "file" }))
297+
do
294298
table.insert(files, v)
295299
end
296300
end

lua/telescope/previewers/buffer_previewer.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ local Previewer = require "telescope.previewers.previewer"
66
local conf = require("telescope.config").values
77
local global_state = require "telescope.state"
88

9-
local pscan = require "plenary.scandir"
10-
119
local buf_delete = utils.buf_delete
1210
local git_command = utils.__git_command
1311

@@ -145,7 +143,7 @@ local handle_directory_preview = function(filepath, bufnr, opts)
145143
end
146144
end
147145

148-
pscan.ls_async(filepath, {
146+
require("plenary.scandir").ls_async(filepath, {
149147
hidden = true,
150148
group_directories_first = true,
151149
on_exit = vim.schedule_wrap(function(data, sections)

plugin/telescope.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ vim.keymap.set(
100100
"c",
101101
"<Plug>(TelescopeFuzzyCommandSearch)",
102102
"<C-\\>e \"lua require('telescope.builtin').command_history "
103-
.. '{ default_text = [=[" . escape(getcmdline(), \'"\') . "]=] }"<CR><CR>',
103+
.. '{ default_text = [=[" . escape(getcmdline(), \'"\') . "]=] }"<CR><CR>',
104104
{ silent = true, noremap = true }
105105
)
106106

0 commit comments

Comments
 (0)