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")
33local Decorator = require (" nvim-tree.renderer.decorator" )
44local DirectoryNode = require (" nvim-tree.node.directory" )
55
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+
617-- highlight groups by severity
718local HG_ICON = {
819 [vim .diagnostic .severity .ERROR ] = " NvimTreeDiagnosticErrorIcon" ,
@@ -51,7 +62,7 @@ function DiagnosticsDecorator:new(args)
5162 self .diag_icons = {}
5263 for name , sev in pairs (ICON_KEYS ) do
5364 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 ],
5566 hl = { HG_ICON [sev ] },
5667 }
5768 self :define_sign (self .diag_icons [sev ])
You can’t perform that action at this time.
0 commit comments