handle cases where filetype icon highlight is not set (#589)
This commit is contained in:
parent
32c85cd214
commit
09f749cbb1
|
@ -37,19 +37,21 @@ function M:apply_icon()
|
||||||
|
|
||||||
if icon and self.options.colored then
|
if icon and self.options.colored then
|
||||||
local highlight_color = modules.utils.extract_highlight_colors(icon_highlight_group, 'fg')
|
local highlight_color = modules.utils.extract_highlight_colors(icon_highlight_group, 'fg')
|
||||||
local default_highlight = self:get_default_hl()
|
if highlight_color then
|
||||||
local icon_highlight = icon_hl_cache[highlight_color]
|
local default_highlight = self:get_default_hl()
|
||||||
if not icon_highlight or not modules.highlight.highlight_exists(icon_highlight.name .. '_normal') then
|
local icon_highlight = icon_hl_cache[highlight_color]
|
||||||
icon_highlight = modules.highlight.create_component_highlight_group(
|
if not icon_highlight or not modules.highlight.highlight_exists(icon_highlight.name .. '_normal') then
|
||||||
{ fg = highlight_color },
|
icon_highlight = modules.highlight.create_component_highlight_group(
|
||||||
icon_highlight_group,
|
{ fg = highlight_color },
|
||||||
self.options,
|
icon_highlight_group,
|
||||||
false
|
self.options,
|
||||||
)
|
false
|
||||||
icon_hl_cache[highlight_color] = icon_highlight
|
)
|
||||||
end
|
icon_hl_cache[highlight_color] = icon_highlight
|
||||||
|
end
|
||||||
|
|
||||||
icon = modules.highlight.component_format_highlight(icon_highlight) .. icon .. default_highlight
|
icon = modules.highlight.component_format_highlight(icon_highlight) .. icon .. default_highlight
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ok = vim.fn.exists('*WebDevIconsGetFileTypeSymbol')
|
ok = vim.fn.exists('*WebDevIconsGetFileTypeSymbol')
|
||||||
|
|
Loading…
Reference in New Issue