@@ -15,9 +15,9 @@ local severity_levels = {
1515--- @field value integer | nil
1616--- @field cache_version integer
1717
18- --- A dictionary tree containing buffer-severity mappings.
18+ --- The buffer-severity mappings derived during the last diagnostic list update .
1919--- @type table
20- local buffer_severity_dict = {}
20+ local BUFFER_SEVERITY = {}
2121
2222--- The cache version number of the buffer-severity mappings.
2323--- @type integer
@@ -95,10 +95,10 @@ local function from_cache(node)
9595 local max_severity = nil
9696 if not node .nodes then
9797 -- direct cache hit for files
98- max_severity = buffer_severity_dict [nodepath ]
98+ max_severity = BUFFER_SEVERITY [nodepath ]
9999 else
100100 -- 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
102102 local node_contains_buf = vim .startswith (bufname , nodepath .. " /" )
103103 if node_contains_buf then
104104 if severity == M .severity .max then
@@ -120,12 +120,12 @@ function M.update()
120120 utils .debounce (" diagnostics" , M .debounce_delay , function ()
121121 local profile = log .profile_start " diagnostics update"
122122 if is_using_coc () then
123- buffer_severity_dict = from_coc ()
123+ BUFFER_SEVERITY = from_coc ()
124124 else
125- buffer_severity_dict = from_nvim_lsp ()
125+ BUFFER_SEVERITY = from_nvim_lsp ()
126126 end
127127 BUFFER_SEVERITY_VERSION = BUFFER_SEVERITY_VERSION + 1
128- log .node (" diagnostics" , buffer_severity_dict , " update" )
128+ log .node (" diagnostics" , BUFFER_SEVERITY , " update" )
129129 log .profile_end (profile )
130130 if view .is_buf_valid (view .get_bufnr ()) then
131131 require (" nvim-tree.renderer" ).draw ()
0 commit comments