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.
13291329 error = ""
13301330 }
13311331<
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`
13321336==============================================================================
13331337 5.9 OPTS: MODIFIED *nvim-tree-opts-modified*
13341338
Original file line number Diff line number Diff line change @@ -420,6 +420,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
420420 warning = " " ,
421421 error = " " ,
422422 },
423+ diagnostic_opts = false ,
423424 },
424425 modified = {
425426 enable = false ,
Original file line number Diff line number Diff line change 231231function M .setup (opts )
232232 M .enable = opts .diagnostics .enable
233233 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
235238
236239 if M .enable then
237240 log .line (" diagnostics" , " setup" )
Original file line number Diff line number Diff line change @@ -41,17 +41,29 @@ local DiagnosticsDecorator = Decorator:extend()
4141--- @protected
4242--- @param args DecoratorArgs
4343function DiagnosticsDecorator :new (args )
44- self .explorer = args .explorer
44+ self .explorer = args .explorer
4545
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
4961
5062 if self .explorer .opts .renderer .icons .show .diagnostics then
5163 self .diag_icons = {}
5264 for name , sev in pairs (ICON_KEYS ) do
5365 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 ],
5567 hl = { HG_ICON [sev ] },
5668 }
5769 self :define_sign (self .diag_icons [sev ])
You can’t perform that action at this time.
0 commit comments