@@ -4,7 +4,6 @@ local core = require "nvim-tree.core"
4
4
local git = require " nvim-tree.renderer.components.git"
5
5
local pad = require " nvim-tree.renderer.components.padding"
6
6
local icons = require " nvim-tree.renderer.components.icons"
7
- local diagnostics = require " nvim-tree.renderer.components.diagnostics"
8
7
9
8
local HL_POSITION = require (" nvim-tree.enum" ).HL_POSITION
10
9
local ICON_PLACEMENT = require (" nvim-tree.enum" ).ICON_PLACEMENT
@@ -73,14 +72,6 @@ function Builder:configure_git_icons_placement(where)
73
72
return self
74
73
end
75
74
76
- function Builder :configure_diagnostics_icon_placement (where )
77
- if where ~= " after" and where ~= " before" and where ~= " signcolumn" then
78
- where = " before" -- default before
79
- end
80
- self .diagnostics_placement = where
81
- return self
82
- end
83
-
84
75
function Builder :configure_symlink_destination (show )
85
76
self .symlink_destination = show
86
77
return self
218
209
--- @param node table
219
210
--- @return HighlightedString[] | nil icon
220
211
function Builder :_get_diagnostics_icon (node )
221
- local diagnostics_icon = diagnostics . get_icon (node )
222
- if diagnostics_icon and self .diagnostics_placement == " signcolumn" then
212
+ local diagnostics_icon = self . decorators . diagnostics : get_icon (node )
213
+ if diagnostics_icon and self .decorators . diagnostics . icon_placement == ICON_PLACEMENT . signcolumn then
223
214
table.insert (self .signs , {
224
215
sign = diagnostics_icon .hl [1 ],
225
216
lnum = self .index + 1 ,
248
239
--- @param node table
249
240
--- @return HighlightedString[] | nil icon
250
241
function Builder :_get_bookmark_icon (node )
251
- local bookmark_icon = self .decorators .bookmark :get_icon (node )
252
- if bookmark_icon and self .decorators .bookmark .icon_placement == ICON_PLACEMENT .signcolumn then
242
+ local bookmark_icon = self .decorators .bookmarks :get_icon (node )
243
+ if bookmark_icon and self .decorators .bookmarks .icon_placement == ICON_PLACEMENT .signcolumn then
253
244
table.insert (self .signs , {
254
245
sign = bookmark_icon .hl [1 ],
255
246
lnum = self .index + 1 ,
@@ -301,12 +292,12 @@ end
301
292
--- @param icon_hl string[] icons to append to
302
293
--- @param name_hl string[] names to append to
303
294
function Builder :_append_dec_highlight (node , decorator , icon_hl , name_hl )
304
- local pos , hl = decorator :get_highlight (node )
305
- if pos ~= HL_POSITION . none and hl then
306
- if pos == HL_POSITION .all or pos == HL_POSITION .icon then
295
+ local hl = decorator :get_highlight (node )
296
+ if hl then
297
+ if decorator . hl_pos == HL_POSITION .all or decorator . hl_pos == HL_POSITION .icon then
307
298
table.insert (icon_hl , hl )
308
299
end
309
- if pos == HL_POSITION .all or pos == HL_POSITION .name then
300
+ if decorator . hl_pos == HL_POSITION .all or decorator . hl_pos == HL_POSITION .name then
310
301
table.insert (name_hl , hl )
311
302
end
312
303
end
@@ -347,10 +338,10 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
347
338
if modified_icon and self .decorators .modified .icon_placement == ICON_PLACEMENT .before then
348
339
add_to_end (line , { modified_icon })
349
340
end
350
- if diagnostics_icon and self .diagnostics_placement == " before" then
341
+ if diagnostics_icon and self .decorators . diagnostics . icon_placement == ICON_PLACEMENT . before then
351
342
add_to_end (line , { diagnostics_icon })
352
343
end
353
- if bookmark_icon and self .decorators .bookmark .icon_placement == ICON_PLACEMENT .before then
344
+ if bookmark_icon and self .decorators .bookmarks .icon_placement == ICON_PLACEMENT .before then
354
345
add_to_end (line , { bookmark_icon })
355
346
end
356
347
@@ -362,10 +353,10 @@ function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, dia
362
353
if modified_icon and self .decorators .modified .icon_placement == ICON_PLACEMENT .after then
363
354
add_to_end (line , { modified_icon })
364
355
end
365
- if diagnostics_icon and self .diagnostics_placement == " after" then
356
+ if diagnostics_icon and self .decorators . diagnostics . icon_placement == ICON_PLACEMENT . after then
366
357
add_to_end (line , { diagnostics_icon })
367
358
end
368
- if bookmark_icon and self .decorators .bookmark .icon_placement == ICON_PLACEMENT .after then
359
+ if bookmark_icon and self .decorators .bookmarks .icon_placement == ICON_PLACEMENT .after then
369
360
add_to_end (line , { bookmark_icon })
370
361
end
371
362
@@ -409,8 +400,8 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
409
400
-- extra highighting
410
401
self :_append_highlight (node , git .get_highlight , icon .hl , name .hl )
411
402
self :_append_dec_highlight (node , self .decorators .modified , icon .hl , name .hl )
412
- self :_append_dec_highlight (node , self .decorators .bookmark , icon .hl , name .hl )
413
- self :_append_highlight (node , diagnostics . get_highlight , icon .hl , name .hl )
403
+ self :_append_dec_highlight (node , self .decorators .bookmarks , icon .hl , name .hl )
404
+ self :_append_dec_highlight (node , self . decorators . diagnostics , icon .hl , name .hl )
414
405
self :_append_highlight (node , copy_paste .get_highlight , icon .hl , name .hl )
415
406
416
407
local line = self :_format_line (indent_markers , arrows , icon , name , git_icons , diagnostics_icon , modified_icon , bookmark_icon )
0 commit comments