@@ -54,11 +54,6 @@ function Builder:configure_filter(filter, prefix)
54
54
return self
55
55
end
56
56
57
- function Builder :configure_opened_file_highlighting (highlight_opened_files )
58
- self .highlight_opened_files = highlight_opened_files
59
- return self
60
- end
61
-
62
57
function Builder :configure_icon_padding (padding )
63
58
self .icon_padding = padding or " "
64
59
return self
@@ -260,41 +255,6 @@ function Builder:_get_bookmark_icon(node)
260
255
return bookmark_icon
261
256
end
262
257
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
-
298
258
--- Append optional highlighting to icon or name.
299
259
--- @param node table
300
260
--- @param decorator Decorator
@@ -372,7 +332,7 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
372
332
return line
373
333
end
374
334
375
- function Builder :_build_line (node , idx , num_children , unloaded_bufnr )
335
+ function Builder :_build_line (node , idx , num_children )
376
336
-- various components
377
337
local indent_markers = pad .get_indent_markers (self .depth , idx , num_children , node , self .markers )
378
338
local arrows = pad .get_arrows (node )
@@ -395,17 +355,9 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
395
355
icon , name = self :_build_file (node )
396
356
end
397
357
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
-
407
358
-- extra highighting
408
359
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 )
409
361
self :_append_dec_highlight (node , self .decorators .modified , icon .hl , name .hl )
410
362
self :_append_dec_highlight (node , self .decorators .bookmarks , icon .hl , name .hl )
411
363
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)
421
373
422
374
if node .open then
423
375
self .depth = self .depth + 1
424
- self :build (node , unloaded_bufnr )
376
+ self :build (node )
425
377
self .depth = self .depth - 1
426
378
end
427
379
end
@@ -440,12 +392,12 @@ function Builder:_get_nodes_number(nodes)
440
392
return i
441
393
end
442
394
443
- function Builder :build (tree , unloaded_bufnr )
395
+ function Builder :build (tree )
444
396
local num_children = self :_get_nodes_number (tree .nodes )
445
397
local idx = 1
446
398
for _ , node in ipairs (tree .nodes ) do
447
399
if not node .hidden then
448
- self :_build_line (node , idx , num_children , unloaded_bufnr )
400
+ self :_build_line (node , idx , num_children )
449
401
idx = idx + 1
450
402
end
451
403
end
0 commit comments