diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2021-04-09 13:04:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-09 13:04:01 -0400 |
| commit | ba1e674e68a251ce7dcaf44a7b815431ba563f8f (patch) | |
| tree | 702c7649dcadd067a948b8248704cedcfb3eb2a5 /lua/telescope/builtin/internal.lua | |
| parent | 2ebbf7f9d4fbc29b6075dd8fce86e05675a745c2 (diff) | |
fix: update to newer code (#744)
Diffstat (limited to 'lua/telescope/builtin/internal.lua')
| -rw-r--r-- | lua/telescope/builtin/internal.lua | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index a58c354..7eefcb2 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -862,6 +862,47 @@ internal.spell_suggest = function(opts) }):find() end +internal.tagstack = function(opts) + opts = opts or {} + local tagstack = vim.fn.gettagstack() + if vim.tbl_isempty(tagstack.items) then + print("No tagstack available") + return + end + + for _, value in pairs(tagstack.items) do + value.valid = true + value.bufnr = value.from[1] + value.lnum = value.from[2] + value.col = value.from[3] + value.filename = vim.fn.bufname(value.from[1]) + + value.text = vim.api.nvim_buf_get_lines( + value.bufnr, + value.lnum - 1, + value.lnum, + false + )[1] + end + + -- reverse the list + local tags = {} + for i = #tagstack.items, 1, -1 do + tags[#tags+1] = tagstack.items[i] + end + + pickers.new(opts, { + prompt_title = 'TagStack', + finder = finders.new_table { + results = tags, + entry_maker = make_entry.gen_from_quickfix(opts), + }, + previewer = previewers.vim_buffer_qflist.new(opts), + sorter = conf.generic_sorter(opts), + }):find() +end + + local function apply_checks(mod) for k, v in pairs(mod) do mod[k] = function(opts) |
