Skip to content

Commit

Permalink
Prefer using values() to items()
Browse files Browse the repository at this point in the history
Use values() instead of items() where dictionary keys are not used in
iteration.
  • Loading branch information
mityu committed Mar 18, 2024
1 parent f7ccf00 commit a622a0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/lsp/internal/diagnostics/state.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a622a0b

Please sign in to comment.