telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

Ability to list help_tags for specific file

Open stasjok opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. Sometimes I find myself trying to call document symbols in a help file. So I want to map the key I use for document symbols to list help tags in the current help file.

Describe the solution you'd like Ability to call help_tags picker with a filename (specifically I want to provide current filename).

Describe alternatives you've considered

Additional context

stasjok avatar Aug 13 '23 12:08 stasjok

I think I'm a little bit confused about what you're trying to do but to open help_tags with the current filename you can do :lua require('telescope.builtin').help_tags({ default_text = vim.fn.expand('%:t') }) or something.

see :h expand() and the modifiers if you want to tweak the path some more.

jamestrew avatar Aug 16 '23 23:08 jamestrew

I think I'm a little bit confused about what you're trying to do but to open help_tags with the current filename you can do :lua require('telescope.builtin').help_tags({ default_text = vim.fn.expand('%:t') }) or something.

see :h expand() and the modifiers if you want to tweak the path some more.

No, I don't want to change default_text. I want help_tags to not list everything, but only tags related to current help file. So if I already reading e.g. lsp.txt, I want to open telescope with a list of tags from lsp.txt. It's like gO, only not for sections, but for all tags and with telescope.

:lua require('telescope.builtin').help_tags({ default_text = vim.fn.expand('%:t') }) just enters default text in a search field. Since help_tags doesn't show any filenames, it doesn't filter a list by filename. Or is there a way for it to show filenames?

But basically what I asked was, here I think tag list is generated: https://github.com/nvim-telescope/telescope.nvim/blob/2d92125620417fbea82ec30303823e3cd69e90e8/lua/telescope/builtin/__internal.lua#L681-L730 And there is already filename field. I'd like to prefilter tags by this filename.

If I go back to my analogy with LSP, there is document symbols (only for current file), and there is workspace symbols (for the entire project). I thought that it could be useful sometimes to list tags in a current help file, and I can map it to the same keys I use for document/workspace symbols.

stasjok avatar Aug 17 '23 07:08 stasjok

I think this could be solved with a generic opts filter fn, like i proposed here: https://github.com/nvim-telescope/telescope.nvim/pull/2132#pullrequestreview-1071935517

then you could just provide a function that does the filtering. Preferably doing it with iterators. If we wait for nvim 0.10 we could use vim.iter

Conni2461 avatar Oct 11 '23 15:10 Conni2461