diff options
| author | Antoine <ajamadec@gmail.com> | 2022-06-09 15:54:50 +0200 |
|---|---|---|
| committer | Simon Hauser <simon.hauser@helsinki-systems.de> | 2022-06-30 14:01:50 +0200 |
| commit | 15f6a0bb08f934bc999c8b5e54fb574f5889558f (patch) | |
| tree | 3720235c4b7ceaf31df26b97417165da1b1a7a26 | |
| parent | 8488cd5ac7a5c5b99773b5b8de5723ce4cedc796 (diff) | |
feat(tags): process tagfiles on the fly (#1989)
| -rw-r--r-- | lua/telescope/builtin/files.lua | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index f078f45..578f6de 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -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() |
