File tree 3 files changed +43
-0
lines changed
3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ builtin.filetypes = require('telescope.builtin.internal').filetypes
60
60
builtin .highlights = require (' telescope.builtin.internal' ).highlights
61
61
builtin .autocommands = require (' telescope.builtin.internal' ).autocommands
62
62
builtin .spell_suggest = require (' telescope.builtin.internal' ).spell_suggest
63
+ builtin .tagstack = require (' telescope.builtin.internal' ).tagstack
63
64
64
65
builtin .lsp_references = require (' telescope.builtin.lsp' ).references
65
66
builtin .lsp_definitions = require (' telescope.builtin.lsp' ).definitions
Original file line number Diff line number Diff line change @@ -862,6 +862,47 @@ internal.spell_suggest = function(opts)
862
862
}):find ()
863
863
end
864
864
865
+ internal .tagstack = function (opts )
866
+ opts = opts or {}
867
+ local tagstack = vim .fn .gettagstack ()
868
+ if vim .tbl_isempty (tagstack .items ) then
869
+ print (" No tagstack available" )
870
+ return
871
+ end
872
+
873
+ for _ , value in pairs (tagstack .items ) do
874
+ value .valid = true
875
+ value .bufnr = value .from [1 ]
876
+ value .lnum = value .from [2 ]
877
+ value .col = value .from [3 ]
878
+ value .filename = vim .fn .bufname (value .from [1 ])
879
+
880
+ value .text = vim .api .nvim_buf_get_lines (
881
+ value .bufnr ,
882
+ value .lnum - 1 ,
883
+ value .lnum ,
884
+ false
885
+ )[1 ]
886
+ end
887
+
888
+ -- reverse the list
889
+ local tags = {}
890
+ for i = # tagstack .items , 1 , - 1 do
891
+ tags [# tags + 1 ] = tagstack .items [i ]
892
+ end
893
+
894
+ pickers .new (opts , {
895
+ prompt_title = ' TagStack' ,
896
+ finder = finders .new_table {
897
+ results = tags ,
898
+ entry_maker = make_entry .gen_from_quickfix (opts ),
899
+ },
900
+ previewer = previewers .vim_buffer_qflist .new (opts ),
901
+ sorter = conf .generic_sorter (opts ),
902
+ }):find ()
903
+ end
904
+
905
+
865
906
local function apply_checks (mod )
866
907
for k , v in pairs (mod ) do
867
908
mod [k ] = function (opts )
Original file line number Diff line number Diff line change @@ -317,6 +317,7 @@ function make_entry.gen_from_quickfix(opts)
317
317
) .. ' ' .. entry .text ,
318
318
display = make_display ,
319
319
320
+ bufnr = entry .bufnr ,
320
321
filename = filename ,
321
322
lnum = entry .lnum ,
322
323
col = entry .col ,
You can’t perform that action at this time.
0 commit comments