@@ -54,11 +54,6 @@ function Builder:configure_filter(filter, prefix)
5454 return self
5555end
5656
57- function Builder :configure_opened_file_highlighting (highlight_opened_files )
58- self .highlight_opened_files = highlight_opened_files
59- return self
60- end
61-
6257function Builder :configure_icon_padding (padding )
6358 self .icon_padding = padding or " "
6459 return self
@@ -260,41 +255,6 @@ function Builder:_get_bookmark_icon(node)
260255 return bookmark_icon
261256end
262257
263- --- @param node table
264- --- @return string | nil icon_hl
265- --- @return string | nil name_hl
266- function Builder :_get_highlight_override (node , unloaded_bufnr )
267- local name_hl , icon_hl
268-
269- -- opened file
270- if self .highlight_opened_files and vim .fn .bufloaded (node .absolute_path ) > 0 and vim .fn .bufnr (node .absolute_path ) ~= unloaded_bufnr then
271- if self .highlight_opened_files == " all" or self .highlight_opened_files == " name" then
272- name_hl = " NvimTreeOpenedFile"
273- end
274- if self .highlight_opened_files == " all" or self .highlight_opened_files == " icon" then
275- icon_hl = " NvimTreeOpenedFileIcon"
276- end
277- end
278- return icon_hl , name_hl
279- end
280-
281- --- Append optional highlighting to icon or name.
282- --- @param node table
283- --- @param get_hl fun ( node : table ): HL_POSITION , string
284- --- @param icon_hl string[] icons to append to
285- --- @param name_hl string[] names to append to
286- function Builder :_append_highlight (node , get_hl , icon_hl , name_hl )
287- local pos , hl = get_hl (node )
288- if pos ~= HL_POSITION .none and hl then
289- if pos == HL_POSITION .all or pos == HL_POSITION .icon then
290- table.insert (icon_hl , hl )
291- end
292- if pos == HL_POSITION .all or pos == HL_POSITION .name then
293- table.insert (name_hl , hl )
294- end
295- end
296- end
297-
298258--- Append optional highlighting to icon or name.
299259--- @param node table
300260--- @param decorator Decorator
@@ -372,7 +332,7 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
372332 return line
373333end
374334
375- function Builder :_build_line (node , idx , num_children , unloaded_bufnr )
335+ function Builder :_build_line (node , idx , num_children )
376336 -- various components
377337 local indent_markers = pad .get_indent_markers (self .depth , idx , num_children , node , self .markers )
378338 local arrows = pad .get_arrows (node )
@@ -395,17 +355,9 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
395355 icon , name = self :_build_file (node )
396356 end
397357
398- -- highlight override
399- local icon_hl_override , name_hl_override = self :_get_highlight_override (node , unloaded_bufnr )
400- if icon_hl_override then
401- icon .hl = { icon_hl_override }
402- end
403- if name_hl_override then
404- name .hl = { name_hl_override }
405- end
406-
407358 -- extra highighting
408359 self :_append_dec_highlight (node , self .decorators .git , icon .hl , name .hl )
360+ self :_append_dec_highlight (node , self .decorators .opened , icon .hl , name .hl )
409361 self :_append_dec_highlight (node , self .decorators .modified , icon .hl , name .hl )
410362 self :_append_dec_highlight (node , self .decorators .bookmarks , icon .hl , name .hl )
411363 self :_append_dec_highlight (node , self .decorators .diagnostics , icon .hl , name .hl )
@@ -421,7 +373,7 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
421373
422374 if node .open then
423375 self .depth = self .depth + 1
424- self :build (node , unloaded_bufnr )
376+ self :build (node )
425377 self .depth = self .depth - 1
426378 end
427379end
@@ -440,12 +392,12 @@ function Builder:_get_nodes_number(nodes)
440392 return i
441393end
442394
443- function Builder :build (tree , unloaded_bufnr )
395+ function Builder :build (tree )
444396 local num_children = self :_get_nodes_number (tree .nodes )
445397 local idx = 1
446398 for _ , node in ipairs (tree .nodes ) do
447399 if not node .hidden then
448- self :_build_line (node , idx , num_children , unloaded_bufnr )
400+ self :_build_line (node , idx , num_children )
449401 idx = idx + 1
450402 end
451403 end
0 commit comments