From: Yegappan Lakshmanan Date: Sat, 1 Jul 2023 04:50:31 +0000 (-0700) Subject: Minor optimizations X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=f95ea34b21b0ad562de6b6f1ef4d8fee4686be41;p=vim-lsp.git Minor optimizations --- diff --git a/autoload/lsp/buffer.vim b/autoload/lsp/buffer.vim index 54c191b..85a07ca 100644 --- a/autoload/lsp/buffer.vim +++ b/autoload/lsp/buffer.vim @@ -98,7 +98,8 @@ export def BufLspServerGet(bnr: number, feature: string = null_string): dicthas_key(feature) && lspserver.features[feature] + var has_feature = lspserver.features->get(feature, false) + if has_feature return lspserver endif endfor diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 7ea2416..6a2bdda 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -90,7 +90,8 @@ def LspCompleteItemKindChar(kind: number): string var kindName = kindMap[kind] var kindValue = defaultKinds[kindName] - if opt.lspOptions.customCompletionKinds && opt.lspOptions.completionKinds->has_key(kindName) + if opt.lspOptions.customCompletionKinds + && opt.lspOptions.completionKinds->has_key(kindName) kindValue = opt.lspOptions.completionKinds[kindName] endif @@ -532,11 +533,11 @@ enddef # then set the 'filetype' to "lspgfm". def LspSetPopupFileType() var item = v:event.completed_item - if !item->has_key('user_data') || item.user_data->empty() + var cItem = item->get('user_data', {}) + if cItem->empty() return endif - var cItem = item.user_data if cItem->type() != v:t_dict || !cItem->has_key('documentation') \ || cItem.documentation->type() != v:t_dict \ || cItem.documentation.kind != 'markdown'