@@ -5,7 +5,6 @@ local notify = require "nvim-tree.notify"
5
5
local git = require " nvim-tree.renderer.components.git"
6
6
local pad = require " nvim-tree.renderer.components.padding"
7
7
local icons = require " nvim-tree.renderer.components.icons"
8
- local diagnostics = require " nvim-tree.renderer.components.diagnostics"
9
8
10
9
local HL_POSITION = require (" nvim-tree.enum" ).HL_POSITION
11
10
local ICON_PLACEMENT = require (" nvim-tree.enum" ).ICON_PLACEMENT
@@ -74,14 +73,6 @@ function Builder:configure_git_icons_placement(where)
74
73
return self
75
74
end
76
75
77
- function Builder :configure_diagnostics_icon_placement (where )
78
- if where ~= " after" and where ~= " before" and where ~= " signcolumn" then
79
- where = " before" -- default before
80
- end
81
- self .diagnostics_placement = where
82
- return self
83
- end
84
-
85
76
function Builder :configure_symlink_destination (show )
86
77
self .symlink_destination = show
87
78
return self
236
227
--- @param node table
237
228
--- @return HighlightedString[] | nil icon
238
229
function Builder :_get_diagnostics_icon (node )
239
- local diagnostics_icon = diagnostics . get_icon (node )
240
- if diagnostics_icon and self .diagnostics_placement == " signcolumn" then
230
+ local diagnostics_icon = self . decorators . diagnostics : get_icon (node )
231
+ if diagnostics_icon and self .decorators . diagnostics . icon_placement == ICON_PLACEMENT . signcolumn then
241
232
table.insert (self .signs , {
242
233
sign = diagnostics_icon .hl [1 ],
243
234
lnum = self .index + 1 ,
266
257
--- @param node table
267
258
--- @return HighlightedString[] | nil icon
268
259
function Builder :_get_bookmark_icon (node )
269
- local bookmark_icon = self .decorators .bookmark :get_icon (node )
270
- if bookmark_icon and self .decorators .bookmark .icon_placement == ICON_PLACEMENT .signcolumn then
260
+ local bookmark_icon = self .decorators .bookmarks :get_icon (node )
261
+ if bookmark_icon and self .decorators .bookmarks .icon_placement == ICON_PLACEMENT .signcolumn then
271
262
table.insert (self .signs , {
272
263
sign = bookmark_icon .hl [1 ],
273
264
lnum = self .index + 1 ,
@@ -319,12 +310,12 @@ end
319
310
--- @param icon_hl string[] icons to append to
320
311
--- @param name_hl string[] names to append to
321
312
function Builder :_append_dec_highlight (node , decorator , icon_hl , name_hl )
322
- local pos , hl = decorator :get_highlight (node )
323
- if pos ~= HL_POSITION . none and hl then
324
- if pos == HL_POSITION .all or pos == HL_POSITION .icon then
313
+ local hl = decorator :get_highlight (node )
314
+ if hl then
315
+ if decorator . hl_pos == HL_POSITION .all or decorator . hl_pos == HL_POSITION .icon then
325
316
table.insert (icon_hl , hl )
326
317
end
327
- if pos == HL_POSITION .all or pos == HL_POSITION .name then
318
+ if decorator . hl_pos == HL_POSITION .all or decorator . hl_pos == HL_POSITION .name then
328
319
table.insert (name_hl , hl )
329
320
end
330
321
end
@@ -365,10 +356,10 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
365
356
if modified_icon and self .decorators .modified .icon_placement == ICON_PLACEMENT .before then
366
357
add_to_end (line , { modified_icon })
367
358
end
368
- if diagnostics_icon and self .diagnostics_placement == " before" then
359
+ if diagnostics_icon and self .decorators . diagnostics . icon_placement == ICON_PLACEMENT . before then
369
360
add_to_end (line , { diagnostics_icon })
370
361
end
371
- if bookmark_icon and self .decorators .bookmark .icon_placement == ICON_PLACEMENT .before then
362
+ if bookmark_icon and self .decorators .bookmarks .icon_placement == ICON_PLACEMENT .before then
372
363
add_to_end (line , { bookmark_icon })
373
364
end
374
365
@@ -380,10 +371,10 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
380
371
if modified_icon and self .decorators .modified .icon_placement == ICON_PLACEMENT .after then
381
372
add_to_end (line , { modified_icon })
382
373
end
383
- if diagnostics_icon and self .diagnostics_placement == " after" then
374
+ if diagnostics_icon and self .decorators . diagnostics . icon_placement == ICON_PLACEMENT . after then
384
375
add_to_end (line , { diagnostics_icon })
385
376
end
386
- if bookmark_icon and self .decorators .bookmark .icon_placement == ICON_PLACEMENT .after then
377
+ if bookmark_icon and self .decorators .bookmarks .icon_placement == ICON_PLACEMENT .after then
387
378
add_to_end (line , { bookmark_icon })
388
379
end
389
380
@@ -427,8 +418,8 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
427
418
-- extra highighting
428
419
self :_append_highlight (node , git .get_highlight , icon .hl , name .hl )
429
420
self :_append_dec_highlight (node , self .decorators .modified , icon .hl , name .hl )
430
- self :_append_dec_highlight (node , self .decorators .bookmark , icon .hl , name .hl )
431
- self :_append_highlight (node , diagnostics . get_highlight , icon .hl , name .hl )
421
+ self :_append_dec_highlight (node , self .decorators .bookmarks , icon .hl , name .hl )
422
+ self :_append_dec_highlight (node , self . decorators . diagnostics , icon .hl , name .hl )
432
423
self :_append_highlight (node , copy_paste .get_highlight , icon .hl , name .hl )
433
424
434
425
local line = self :_format_line (indent_markers , arrows , icon , name , git_icons , diagnostics_icon , modified_icon , bookmark_icon )
0 commit comments