Fix #317 completed snippet problem

This commit is contained in:
Shougo Matsushita 2016-01-01 20:53:21 +09:00
parent 8a13d4a679
commit 57301f8a5d
2 changed files with 16 additions and 0 deletions

View File

@ -316,6 +316,12 @@ function! neosnippet#parser#_get_completed_snippet(completed_item) "{{{
let cnt = 1 let cnt = 1
let snippet = '' let snippet = ''
if empty(filter(values(pairs), 'stridx(abbr, v:val) > 0'))
" Pairs not found pattern
let snippet .= '${' . cnt . '}'
let cnt += 1
endif
if abbr =~ '<.\+>(.*)' if abbr =~ '<.\+>(.*)'
" Add angle analysis " Add angle analysis
let snippet .= '<' let snippet .= '<'

View File

@ -38,6 +38,11 @@ function! s:suite.get_completed_snippet()
\ 'menu' : '', 'info' : '' \ 'menu' : '', 'info' : ''
\ }), ')${1}') \ }), ')${1}')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo(', 'abbr' : '',
\ 'menu' : '', 'info' : ''
\ }), '${1})${2}')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({ call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo(', 'abbr' : 'foo(hoge)', \ 'word' : 'foo(', 'abbr' : 'foo(hoge)',
\ 'menu' : '', 'info' : '' \ 'menu' : '', 'info' : ''
@ -78,6 +83,11 @@ function! s:suite.get_completed_snippet()
\ 'menu' : '', 'info' : '' \ 'menu' : '', 'info' : ''
\ }), '}${1}') \ }), '}${1}')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo{', 'abbr' : 'foo{',
\ 'menu' : '', 'info' : ''
\ }), '${1}}${2}')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({ call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo{', 'abbr' : 'foo{piyo}', \ 'word' : 'foo{', 'abbr' : 'foo{piyo}',
\ 'menu' : '', 'info' : '' \ 'menu' : '', 'info' : ''