Merge pull request #345 from ktonga/item-snippet

Let other plugins better integrate with `g:neosnippet#enable_completed_snippet`
This commit is contained in:
Shougo 2016-06-11 17:04:48 +09:00 committed by GitHub
commit 23eac4b080
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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