File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
lua/nvim-tree/renderer/decorator Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,17 @@ local diagnostics = require("nvim-tree.diagnostics")
3
3
local Decorator = require (" nvim-tree.renderer.decorator" )
4
4
local DirectoryNode = require (" nvim-tree.node.directory" )
5
5
6
+ --- @param severity vim.diagnostic.Severity
7
+ --- @return string ?
8
+ local function get_diagnostics_icons (severity )
9
+ local config = vim .diagnostic .config () or {}
10
+ local signs = config .signs or {}
11
+ if type (signs ) == " function" then
12
+ signs = signs (0 , 0 )
13
+ end
14
+ return (type (signs ) == " table" and signs .text and signs .text [severity ]) or nil
15
+ end
16
+
6
17
-- highlight groups by severity
7
18
local HG_ICON = {
8
19
[vim .diagnostic .severity .ERROR ] = " NvimTreeDiagnosticErrorIcon" ,
@@ -51,7 +62,7 @@ function DiagnosticsDecorator:new(args)
51
62
self .diag_icons = {}
52
63
for name , sev in pairs (ICON_KEYS ) do
53
64
self .diag_icons [sev ] = {
54
- str = self .explorer .opts .diagnostics .icons [name ],
65
+ str = get_diagnostics_icons ( sev ) or self .explorer .opts .diagnostics .icons [name ],
55
66
hl = { HG_ICON [sev ] },
56
67
}
57
68
self :define_sign (self .diag_icons [sev ])
You can’t perform that action at this time.
0 commit comments