Support devicons in lsp_references picker
#3,086 opened on May 2, 2024
Repository metrics
- Stars
- (19,422 stars)
- PR merge metrics
- (Avg merge 4h 23m) (2 merged PRs in 30d)
Description
Is your feature request related to a problem? Please describe. No.
Describe the solution you'd like
Currently, the file pickers support devicons (with an option disable_devicons to disable them), but lsp references picker do not:
It'd be nice to have that option for lsp references as well.
Describe alternatives you've considered
I tried using a custom entry_maker for the lsp references picker. However, I wanted to only override the display function, but I'm not quite sure how to do this. I thought about reusing the current entry maker used for this picker, but I don't know how to access the opts from within the entry_maker function (probably a dumb question).
-- ...
pickers = {
-- ...
lsp_references = {
entry_maker = function(entry)
local opts = {} -- TODO: how can i access these form here?
-- reuse the builtin entry maker
local entry_maker = require("telescope.make_entry").gen_from_quickfix(opts)
-- TODO: return new entry maker that only overrides the display function
end,
},
-- ...
If this is something we can add, I can submit a PR to support devicons and the option to disable them. These are the proposed changes (roughly):
Additional context I assume in most cases lsp references will all be the same file type (whatever the language you're working on is), however, in the case of Angular, you can have references to a symbol from both typescript and html files. Usually the file names are pretty similar and it can be difficult to differentiate them (see screenshot above).
Another example would be *.spec.ts files, which would be easier to identify by the icon rather than scanning down the line to look at the file extension.
Thank you!