fix(icons): improve fallback for multi-part file extensions (#233)

This commit is contained in:
Rizky Ilham Pratama 2024-07-26 10:38:49 +08:00 committed by GitHub
parent bb2c63ee53
commit cef01dee8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -119,7 +119,12 @@ function EntryMaker:items(entry, workspace, workspace_tag, formatter)
end end
if self.web_devicons.is_enabled then if self.web_devicons.is_enabled then
local basename = utils.path_tail(entry.name) local basename = utils.path_tail(entry.name)
table.insert(items, { self.web_devicons:get_icon(basename, utils.file_extension(basename), { default = true }) }) local icon, icon_highlight =
self.web_devicons:get_icon(basename, utils.file_extension(basename), { default = false })
if not icon then
icon, icon_highlight = self.web_devicons:get_icon(basename, nil, { default = true })
end
table.insert(items, { icon, icon_highlight })
end end
if config.show_filter_column and workspace and workspace_tag then if config.show_filter_column and workspace and workspace_tag then
local filtered = self:should_show_tail(workspace_tag) and utils.path_tail(workspace) .. Path.path.sep local filtered = self:should_show_tail(workspace_tag) and utils.path_tail(workspace) .. Path.path.sep