Merge pull request #345 from ktonga/item-snippet
Let other plugins better integrate with `g:neosnippet#enable_completed_snippet`
This commit is contained in:
commit
23eac4b080
@ -301,6 +301,10 @@ endfunction"}}}
|
|||||||
function! neosnippet#parser#_get_completed_snippet(completed_item, next_text) abort "{{{
|
function! neosnippet#parser#_get_completed_snippet(completed_item, next_text) abort "{{{
|
||||||
let item = a:completed_item
|
let item = a:completed_item
|
||||||
|
|
||||||
|
if has_key(item, "snippet")
|
||||||
|
return item.snippet
|
||||||
|
endif
|
||||||
|
|
||||||
" Set abbr
|
" Set abbr
|
||||||
let abbr = (item.abbr != '') ? item.abbr : item.word
|
let abbr = (item.abbr != '') ? item.abbr : item.word
|
||||||
if len(item.menu) > 5
|
if len(item.menu) > 5
|
||||||
|
@ -128,5 +128,10 @@ function! s:suite.get_completed_snippet() abort
|
|||||||
\ 'word' : 'for[', 'abbr' : '',
|
\ 'word' : 'for[', 'abbr' : '',
|
||||||
\ 'menu' : '', 'info' : ''
|
\ 'menu' : '', 'info' : ''
|
||||||
\ }, ''), '${1}]${2}')
|
\ }, ''), '${1}]${2}')
|
||||||
|
|
||||||
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
||||||
|
\ 'word' : 'something', 'abbr' : 'something(else)',
|
||||||
|
\ 'menu' : '', 'info' : '', 'snippet' : '(${1:custom})${2}'
|
||||||
|
\ }, ''), '(${1:custom})${2}')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user