Skip to content

Commit 4008d48

Browse files
committed
refactor(neovim): improve telescope file pickers with proper entry_maker
1 parent 5ac233d commit 4008d48

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

extensions/neovim/lua/codeinput/telescope.lua

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,17 @@ function show_tags_picker(tags, opts)
247247
end
248248

249249
function show_files_for_owner(files, owner, opts)
250+
opts = opts or {}
251+
250252
local file_strings = vim.tbl_map(function(f)
251-
if type(f) == "table" then
252-
return f[1] or vim.inspect(f)
253-
else
254-
return tostring(f)
255-
end
253+
return path_to_string(f)
256254
end, files)
257255

258256
pickers.new(opts, {
259257
prompt_title = string.format("Files owned by %s", owner),
260258
finder = finders.new_table {
261259
results = file_strings,
260+
entry_maker = require("telescope.make_entry").gen_from_file(opts),
262261
},
263262
sorter = conf.file_sorter(opts),
264263
previewer = conf.file_previewer(opts),
@@ -274,18 +273,17 @@ function show_files_for_owner(files, owner, opts)
274273
end
275274

276275
function show_files_for_tag(files, tag, opts)
276+
opts = opts or {}
277+
277278
local file_strings = vim.tbl_map(function(f)
278-
if type(f) == "table" then
279-
return f[1] or vim.inspect(f)
280-
else
281-
return tostring(f)
282-
end
279+
return path_to_string(f)
283280
end, files)
284281

285282
pickers.new(opts, {
286283
prompt_title = string.format("Files tagged #%s", tag),
287284
finder = finders.new_table {
288285
results = file_strings,
286+
entry_maker = require("telescope.make_entry").gen_from_file(opts),
289287
},
290288
sorter = conf.file_sorter(opts),
291289
previewer = conf.file_previewer(opts),

0 commit comments

Comments
 (0)