]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Minor optimizations
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 1 Jul 2023 04:50:31 +0000 (21:50 -0700)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 1 Jul 2023 04:50:31 +0000 (21:50 -0700)
autoload/lsp/buffer.vim
autoload/lsp/completion.vim

index 54c191b6661f9f2812a7f4a8d8c7c8a92b92a1ca..85a07ca2fc0e009a18ef57c746c65dfeca2b2499 100644 (file)
@@ -98,7 +98,8 @@ export def BufLspServerGet(bnr: number, feature: string = null_string): dict<any
 
   # LSP server is configured to be a provider for "feature"
   for lspserver in possibleLSPs
-    if lspserver.features->has_key(feature) && lspserver.features[feature]
+    var has_feature = lspserver.features->get(feature, false)
+    if has_feature
       return lspserver
     endif
   endfor
index 7ea24166c39b083fa43a87e0abe39cd6ffa84007..6a2bdda57ecf50e03aa39046b0021f75cccc07ff 100644 (file)
@@ -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'