Skip to content

Commit c81b0e1

Browse files
committed
bugfix for snips no action
1 parent 0350909 commit c81b0e1

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

autoload/easycomplete.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,20 +1677,25 @@ function! easycomplete#TypeEnterWithPUM()
16771677
let insert_text = get(oitems, 'insertText', '')
16781678
let user_data = easycomplete#util#GetUserData(l:item)
16791679
let custom_expand = get(user_data, 'custom_expand', 0)
1680+
let is_snips = (get(user_data, 'plugin_name', '') == "snips" ? v:true : v:false)
16801681
if custom_expand
16811682
" 简易展开
16821683
let l:back = get(json_decode(l:item['user_data']), 'cursor_backing_steps', 0)
16831684
call timer_start(40, {
16841685
\ -> easycomplete#CursorExpandableSnipBackword(l:back)
16851686
\ })
1687+
elseif is_snips
1688+
" 如果源是 snips
1689+
call easycomplete#sources#snips#cr(l:item, {})
1690+
return s:FlushCtrlY()
16861691
elseif !empty(insert_text) && s:LuaSnipSupports()
1687-
" luasnip 展开
1692+
" lsp 返回的 snip: 如果支持 luaSnip,则用 luasnip 展开
16881693
call timer_start(10, {
16891694
\ -> easycomplete#sources#snips#ExpandLuaSnipManually(insert_text)
16901695
\ })
16911696
return s:FlushCtrlY()
16921697
elseif !empty(insert_text) && s:SnipSupports()
1693-
" ultisnip 展开
1698+
" lsp 返回的 snip: 如果支持 ultiSnip,则用 ultisnip 展开
16941699
let word = get(l:item, "word")
16951700
call s:AsyncRun("UltiSnips#Anon",[insert_text, word], 60)
16961701
call timer_start(30, { -> call(function("UltiSnips#Anon"), [insert_text, word])})

autoload/easycomplete/util.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,8 +1520,12 @@ function! easycomplete#util#expandable(item)
15201520
endif
15211521

15221522
let l:data = json_decode(user_data_str)
1523-
if has_key(l:data, 'expandable') && get(l:data, 'expandable', 0)
1524-
return get(l:data, 'expandable', 0)
1523+
if get(l:data, 'plugin_name', '') == "snips"
1524+
return v:true
1525+
elseif has_key(l:data, 'expandable') && get(l:data, 'expandable', 0) == 1
1526+
return v:true
1527+
else
1528+
return v:false
15251529
endif
15261530
else
15271531
return v:false

0 commit comments

Comments
 (0)