feat(tags): process tagfiles on the fly (#1989)
This commit is contained in:
@@ -422,6 +422,9 @@ end
|
||||
|
||||
files.tags = function(opts)
|
||||
local tagfiles = opts.ctags_file and { opts.ctags_file } or vim.fn.tagfiles()
|
||||
for i, ctags_file in ipairs(tagfiles) do
|
||||
tagfiles[i] = vim.fn.expand(ctags_file, true)
|
||||
end
|
||||
if vim.tbl_isempty(tagfiles) then
|
||||
utils.notify("builtin.tags", {
|
||||
msg = "No tags file found. Create one with ctags -R",
|
||||
@@ -429,20 +432,11 @@ files.tags = function(opts)
|
||||
})
|
||||
return
|
||||
end
|
||||
|
||||
local results = {}
|
||||
for _, ctags_file in ipairs(tagfiles) do
|
||||
for line in Path:new(vim.fn.expand(ctags_file, true)):iter() do
|
||||
results[#results + 1] = line
|
||||
end
|
||||
end
|
||||
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_ctags(opts))
|
||||
|
||||
pickers.new(opts, {
|
||||
prompt_title = "Tags",
|
||||
finder = finders.new_table {
|
||||
results = results,
|
||||
entry_maker = opts.entry_maker or make_entry.gen_from_ctags(opts),
|
||||
},
|
||||
finder = finders.new_oneshot_job(flatten { "cat", tagfiles }, opts),
|
||||
previewer = previewers.ctags.new(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function()
|
||||
|
||||
Reference in New Issue
Block a user