feat(#2369): add full renderer.icons.web_devicons options for file and folder (#2375)

* Add `webdev_colors_folder` option

* Check if `M.devicons` exists

* Refactor `get_folder_icon`

* Add configuration options for both files and folders

* web_devicons.*.enabled -> enable

* silent migration: renderer.icons.webdev_colors -> renderer.icons.web_devicons.file.color

* silent migration: renderer.icons.webdev_colors -> renderer.icons.web_devicons.file.color

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Antonio Sarosi
2023-08-26 06:42:44 +02:00
committed by GitHub
parent d11d701857
commit b144b33390
5 changed files with 87 additions and 17 deletions

View File

@@ -130,11 +130,10 @@ end
---@return HighlightedString icon, HighlightedString name
function Builder:_build_folder(node)
local has_children = #node.nodes ~= 0 or node.has_children
local icon = icons.get_folder_icon(node.open, node.link_to ~= nil, has_children)
local icon, icon_hl = icons.get_folder_icon(node, has_children)
local foldername = get_folder_name(node) .. self.trailing_slash
local icon_hl
if #icon > 0 then
if #icon > 0 and icon_hl == nil then
if node.open then
icon_hl = "NvimTreeOpenedFolderIcon"
else