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!

貢獻者指南