Skip to content

Commit a8e28a2

Browse files
committed
bugfix
1 parent 395e25b commit a8e28a2

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

autoload/easycomplete/sources/buf.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ function! easycomplete#sources#buf#completor(opt, ctx)
2020
" call easycomplete#util#timer_start("easycomplete#sources#buf#CompleteHandler",
2121
" \ [l:typing, a:opt['name'], a:ctx, a:ctx['startcol']], 0)
2222

23-
call easycomplete#complete(a:opt['name'], a:ctx, a:ctx['startcol'], [])
23+
call easycomplete#sources#buf#CompleteHandler(l:typing, a:opt['name'], a:ctx, a:ctx['startcol'])
2424

25+
" call easycomplete#complete(a:opt['name'], a:ctx, a:ctx['startcol'], [])
2526
return v:true
2627
endfunction
2728

autoload/easycomplete/util.vim

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,9 +1717,9 @@ function! s:BadBoy.Vim(item, typing_word)
17171717
if &filetype != "vim" | return v:false | endif
17181718
let word = get(a:item, "label", "")
17191719
if empty(word) | return v:true | endif
1720-
let pos = stridx(word, a:typing_word)
17211720
if len(a:typing_word) == 1
1722-
if pos >= 0 && pos <= 7
1721+
let pos = stridx(word, a:typing_word)
1722+
if pos >= 0 && pos <= 5
17231723
return v:false
17241724
else
17251725
return v:true
@@ -1838,11 +1838,15 @@ function! easycomplete#util#GetVimCompletionItems(response, plugin_name)
18381838
let l:items_length = len(l:items)
18391839
let typing_word = easycomplete#util#GetTypingWord()
18401840
for l:completion_item in l:items
1841-
if s:BadBoy.Nim(l:completion_item, typing_word) | continue | endif
1842-
if s:BadBoy.Vim(l:completion_item, typing_word) | continue | endif
1843-
if s:BadBoy.Dart(l:completion_item, typing_word) | continue | endif
1841+
if &filetype == "nim" && s:BadBoy.Nim(l:completion_item, typing_word) | continue | endif
1842+
if &filetype == "vim" && s:BadBoy.Vim(l:completion_item, typing_word) | continue | endif
1843+
if &filetype == "dart" && s:BadBoy.Dart(l:completion_item, typing_word) | continue | endif
18441844
let l:expandable = get(l:completion_item, 'insertTextFormat', 1) == 2
1845-
let l:lsp_type_obj = easycomplete#util#LspType(get(l:completion_item, 'kind', 0))
1845+
if has_key(l:completion_item, "kind")
1846+
let l:lsp_type_obj = easycomplete#util#LspType(l:completion_item["kind"])
1847+
else
1848+
let l:lsp_type_obj = easycomplete#util#LspType(0)
1849+
endif
18461850
let l:menu_str = g:easycomplete_menu_abbr ? "[". toupper(a:plugin_name) ."]" : l:lsp_type_obj["fullname"]
18471851
let l:vim_complete_item = {
18481852
\ 'kind': get(l:lsp_type_obj, "symble"),

0 commit comments

Comments
 (0)