1
+ local DirectoryLinkNode = require (" nvim-tree.node.directory-link" )
2
+
1
3
local M = { i = {} }
2
4
3
5
local function config_symlinks ()
@@ -11,39 +13,40 @@ local function empty()
11
13
return " " , nil
12
14
end
13
15
14
- --- @param node Node
16
+ --- @param dir DirectoryNode
15
17
--- @param has_children boolean
16
18
--- @return string icon
17
19
--- @return string ? name
18
- local function get_folder_icon_default (node , has_children )
19
- local is_symlink = node .links_to ~= nil
20
- local n
21
- if is_symlink and node .open then
22
- n = M .config .glyphs .folder .symlink_open
23
- elseif is_symlink then
24
- n = M .config .glyphs .folder .symlink
25
- elseif node .open then
20
+ local function get_folder_icon_default (dir , has_children )
21
+ local icon
22
+ if dir :is (DirectoryLinkNode ) then
23
+ if dir .open then
24
+ icon = M .config .glyphs .folder .symlink_open
25
+ else
26
+ icon = M .config .glyphs .folder .symlink
27
+ end
28
+ elseif dir .open then
26
29
if has_children then
27
- n = M .config .glyphs .folder .open
30
+ icon = M .config .glyphs .folder .open
28
31
else
29
- n = M .config .glyphs .folder .empty_open
32
+ icon = M .config .glyphs .folder .empty_open
30
33
end
31
34
else
32
35
if has_children then
33
- n = M .config .glyphs .folder .default
36
+ icon = M .config .glyphs .folder .default
34
37
else
35
- n = M .config .glyphs .folder .empty
38
+ icon = M .config .glyphs .folder .empty
36
39
end
37
40
end
38
- return n , nil
41
+ return icon , nil
39
42
end
40
43
41
- --- @param node Node
44
+ --- @param node DirectoryNode
42
45
--- @param has_children boolean
43
46
--- @return string icon
44
47
--- @return string ? name
45
48
local function get_folder_icon_webdev (node , has_children )
46
- local icon , hl_group = M .devicons .get_icon (node .name , node . extension )
49
+ local icon , hl_group = M .devicons .get_icon (node .name , nil )
47
50
if not M .config .web_devicons .folder .color then
48
51
hl_group = nil
49
52
end
0 commit comments