feat: Pass in the buffer number for symbols.icon_fetcher

This commit is contained in:
~hedy
2024-07-05 12:51:48 +08:00
parent 028e0bc8ad
commit bc58f196ec
4 changed files with 57 additions and 6 deletions

View File

@@ -46,7 +46,8 @@ for k, v in pairs(M.kinds) do
end
---@param kind string|integer
function M.icon_from_kind(kind)
---@param bufnr integer
function M.icon_from_kind(kind, bufnr)
local kindstr = kind
if type(kind) ~= 'string' then
kindstr = M.kinds[kind]
@@ -56,7 +57,7 @@ function M.icon_from_kind(kind)
end
if type(cfg.o.symbols.icon_fetcher) == 'function' then
local icon = cfg.o.symbols.icon_fetcher(kindstr)
local icon = cfg.o.symbols.icon_fetcher(kindstr, bufnr)
-- Allow returning empty string
if icon then
return icon