nvim-telescope/telescope.nvim

Support devicons in lsp_references picker

开放

#3,086 创建于 2024年5月2日

 (1 条评论) (3 个反应) (0 位负责人)Lua (953 个派生)batch import
enhancementgood first issue

仓库指标

星标
 (19,422 个星标)
PR 合并指标
 (平均合并 4小时 23分钟) (30 天内合并 2 个 PR)

描述

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: image image 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): image

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!

贡献者指南