@@ -15,9 +15,9 @@ local severity_levels = {
15
15
--- @field value integer | nil
16
16
--- @field cache_version integer
17
17
18
- --- A dictionary tree containing buffer-severity mappings.
18
+ --- The buffer-severity mappings derived during the last diagnostic list update .
19
19
--- @type table
20
- local buffer_severity_dict = {}
20
+ local BUFFER_SEVERITY = {}
21
21
22
22
--- The cache version number of the buffer-severity mappings.
23
23
--- @type integer
@@ -95,10 +95,10 @@ local function from_cache(node)
95
95
local max_severity = nil
96
96
if not node .nodes then
97
97
-- direct cache hit for files
98
- max_severity = buffer_severity_dict [nodepath ]
98
+ max_severity = BUFFER_SEVERITY [nodepath ]
99
99
else
100
100
-- dirs should be searched in the list of cached buffer names by prefix
101
- for bufname , severity in pairs (buffer_severity_dict ) do
101
+ for bufname , severity in pairs (BUFFER_SEVERITY ) do
102
102
local node_contains_buf = vim .startswith (bufname , nodepath .. " /" )
103
103
if node_contains_buf then
104
104
if severity == M .severity .max then
@@ -120,12 +120,12 @@ function M.update()
120
120
utils .debounce (" diagnostics" , M .debounce_delay , function ()
121
121
local profile = log .profile_start " diagnostics update"
122
122
if is_using_coc () then
123
- buffer_severity_dict = from_coc ()
123
+ BUFFER_SEVERITY = from_coc ()
124
124
else
125
- buffer_severity_dict = from_nvim_lsp ()
125
+ BUFFER_SEVERITY = from_nvim_lsp ()
126
126
end
127
127
BUFFER_SEVERITY_VERSION = BUFFER_SEVERITY_VERSION + 1
128
- log .node (" diagnostics" , buffer_severity_dict , " update" )
128
+ log .node (" diagnostics" , BUFFER_SEVERITY , " update" )
129
129
log .profile_end (profile )
130
130
if view .is_buf_valid (view .get_bufnr ()) then
131
131
require (" nvim-tree.renderer" ).draw ()
0 commit comments