autoload/lsp/completion.vim | 23 +++++++++++++---------- diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 4d04190e0ae879f47f8e7681e64dde5adc12daf6..2928d65260fffeb84e5cd0f8e32c970084b9d8e6 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -92,9 +92,22 @@ items = cItems.items lspserver.completeItemsIsIncomplete = cItems.isIncomplete endif + # Get the keyword prefix before the current cursor column. + var chcol = charcol('.') + var starttext = chcol == 1 ? '' : getline('.')[ : chcol - 2] + var [prefix, start_idx, end_idx] = starttext->matchstrpos('\k*$') + if opt.lspOptions.completionMatcher == 'icase' + prefix = prefix->tolower() + endif + + var start_col = start_idx + 1 + if opt.lspOptions.ultisnipsSupport call UltiSnips#SnippetsInCurrentScope(1) for [key, info] in items(g:current_ulti_dict_info) + if matchfuzzy([key], prefix)->empty() + continue + endif var parts = split(info.location, ':') var txt = readfile(parts[0])[str2nr(parts[1]) : str2nr(parts[1]) + 20] var restxt = info.description .. "\n\n" @@ -116,16 +129,6 @@ documentation: restxt, }) endfor endif - - # Get the keyword prefix before the current cursor column. - var chcol = charcol('.') - var starttext = chcol == 1 ? '' : getline('.')[ : chcol - 2] - var [prefix, start_idx, end_idx] = starttext->matchstrpos('\k*$') - if opt.lspOptions.completionMatcher == 'icase' - prefix = prefix->tolower() - endif - - var start_col = start_idx + 1 #writefile([$'chcol = {chcol}, starttext = [{starttext}], prefix = [{prefix}], start_idx = {start_idx}, end_idx = {end_idx}, start_col = {start_col}'], '/tmp/lspcomplete.log', 'a')