From a622a0bc79abf041512eac1c32cffe65d52745f3 Mon Sep 17 00:00:00 2001 From: mityu Date: Tue, 19 Mar 2024 06:28:49 +0900 Subject: [PATCH] Prefer using values() to items() Use values() instead of items() where dictionary keys are not used in iteration. --- autoload/lsp/internal/diagnostics/state.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/lsp/internal/diagnostics/state.vim b/autoload/lsp/internal/diagnostics/state.vim index 41ffa2774..4cd5d0d5f 100644 --- a/autoload/lsp/internal/diagnostics/state.vim +++ b/autoload/lsp/internal/diagnostics/state.vim @@ -108,7 +108,7 @@ endfunction function! s:on_exit(response) abort let l:server = a:response['params']['server'] let l:notify = 0 - for [l:key, l:value] in items(s:diagnostics_state) + for l:value in values(s:diagnostics_state) if has_key(l:value, l:server) let l:notify = 1 call remove(l:value, l:server) @@ -162,7 +162,7 @@ function! lsp#internal#diagnostics#state#_get_diagnostics_count_for_buffer(bufnr \ } if lsp#internal#diagnostics#state#_is_enabled_for_buffer(a:bufnr) let l:uri = lsp#utils#get_buffer_uri(a:bufnr) - for [l:_, l:response] in items(lsp#internal#diagnostics#state#_get_all_diagnostics_grouped_by_server_for_uri(l:uri)) + for l:response in values(lsp#internal#diagnostics#state#_get_all_diagnostics_grouped_by_server_for_uri(l:uri)) for l:diagnostic in lsp#utils#iteratable(l:response['params']['diagnostics']) let l:key = get(s:diagnostic_kinds, get(l:diagnostic, 'severity', 1) , 'error') let l:counts[l:key] += 1