File tree Expand file tree Collapse file tree 4 files changed +26
-6
lines changed Expand file tree Collapse file tree 4 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -1329,6 +1329,10 @@ Icons for diagnostic severity.
1329
1329
error = ""
1330
1330
}
1331
1331
<
1332
+ *nvim-tree.diagnostics.diagnostic_opts*
1333
+ | vim.diagnostic.Opts | overrides | nvim-tree.diagnostics.severity | and
1334
+ | nvim-tree.diagnostics.icons |
1335
+ Type: `boolean ` , Default: `false`
1332
1336
==============================================================================
1333
1337
5.9 OPTS: MODIFIED *nvim-tree-opts-modified*
1334
1338
Original file line number Diff line number Diff line change @@ -420,6 +420,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
420
420
warning = " " ,
421
421
error = " " ,
422
422
},
423
+ diagnostic_opts = false ,
423
424
},
424
425
modified = {
425
426
enable = false ,
Original file line number Diff line number Diff line change 231
231
function M .setup (opts )
232
232
M .enable = opts .diagnostics .enable
233
233
M .debounce_delay = opts .diagnostics .debounce_delay
234
- M .severity = opts .diagnostics .severity
234
+ M .severity = opts .diagnostics .diagnostic_opts and {
235
+ min = vim .diagnostic .severity .HINT ,
236
+ max = vim .diagnostic .severity .ERROR
237
+ } or opts .diagnostics .severity
235
238
236
239
if M .enable then
237
240
log .line (" diagnostics" , " setup" )
Original file line number Diff line number Diff line change @@ -41,17 +41,29 @@ local DiagnosticsDecorator = Decorator:extend()
41
41
--- @protected
42
42
--- @param args DecoratorArgs
43
43
function DiagnosticsDecorator :new (args )
44
- self .explorer = args .explorer
44
+ self .explorer = args .explorer
45
45
46
- self .enabled = true
47
- self .highlight_range = self .explorer .opts .renderer .highlight_diagnostics or " none"
48
- self .icon_placement = self .explorer .opts .renderer .icons .diagnostics_placement or " none"
46
+ self .enabled = true
47
+ self .highlight_range = self .explorer .opts .renderer .highlight_diagnostics or " none"
48
+ self .icon_placement = self .explorer .opts .renderer .icons .diagnostics_placement or " none"
49
+
50
+ local vim_diagnostic_icons = {}
51
+
52
+ if self .explorer .opts .diagnostics .diagnostic_opts then
53
+ local vim_diagnostic_config = vim .diagnostic .config () or {}
54
+ local signs = vim_diagnostic_config .signs or {}
55
+ if type (signs ) == " function" then
56
+ signs = signs (0 , 0 )
57
+ end
58
+
59
+ vim_diagnostic_icons = (type (signs ) == " table" and signs .text ) or {}
60
+ end
49
61
50
62
if self .explorer .opts .renderer .icons .show .diagnostics then
51
63
self .diag_icons = {}
52
64
for name , sev in pairs (ICON_KEYS ) do
53
65
self .diag_icons [sev ] = {
54
- str = self .explorer .opts .diagnostics .icons [name ],
66
+ str = vim_diagnostic_icons [ sev ] or self .explorer .opts .diagnostics .icons [name ],
55
67
hl = { HG_ICON [sev ] },
56
68
}
57
69
self :define_sign (self .diag_icons [sev ])
You can’t perform that action at this time.
0 commit comments