]> Sergey Matveev's repositories - vim-lsp.git/blobdiff - autoload/lsp/options.vim
Dict key access optimizations
[vim-lsp.git] / autoload / lsp / options.vim
index f372053e51b638580a65842eb69c4595c4eda4d7..b8fbb95ec720ba196d2565fce13b0033494770c8 100644 (file)
@@ -87,6 +87,10 @@ export var lspOptions: dict<any> = {
   completionKinds: {}
 }
 
+export const COMPLETIONMATCHER_CASE = 1
+export const COMPLETIONMATCHER_ICASE = 2
+export const COMPLETIONMATCHER_FUZZY = 3
+
 # set the LSP plugin options from the user provided option values
 export def OptionsSet(opts: dict<any>)
   lspOptions->extend(opts)
@@ -96,6 +100,15 @@ export def OptionsSet(opts: dict<any>)
   if !has('patch-9.0.1157')
     lspOptions.showDiagWithVirtualText = false
   endif
+
+  # For faster comparison, convert the 'completionMatcher' option value from a
+  # string to a number.
+  lspOptions.completionMatcherValue = COMPLETIONMATCHER_CASE
+  if lspOptions.completionMatcher == 'icase'
+    lspOptions.completionMatcherValue = COMPLETIONMATCHER_ICASE
+  elseif lspOptions.completionMatcher == 'fuzzy'
+    lspOptions.completionMatcherValue = COMPLETIONMATCHER_FUZZY
+  endif
 enddef
 
 # return a copy of the LSP plugin options