diff --git a/autoload/neosnippet/parser.vim b/autoload/neosnippet/parser.vim index f2da984..1313dfe 100644 --- a/autoload/neosnippet/parser.vim +++ b/autoload/neosnippet/parser.vim @@ -316,6 +316,12 @@ function! neosnippet#parser#_get_completed_snippet(completed_item) "{{{ let cnt = 1 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 =~ '<.\+>(.*)' " Add angle analysis let snippet .= '<' diff --git a/test/functions.vim b/test/functions.vim index b350724..d39a5b6 100644 --- a/test/functions.vim +++ b/test/functions.vim @@ -38,6 +38,11 @@ function! s:suite.get_completed_snippet() \ 'menu' : '', 'info' : '' \ }), ')${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({ \ 'word' : 'foo(', 'abbr' : 'foo(hoge)', \ 'menu' : '', 'info' : '' @@ -78,6 +83,11 @@ function! s:suite.get_completed_snippet() \ 'menu' : '', 'info' : '' \ }), '}${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({ \ 'word' : 'foo{', 'abbr' : 'foo{piyo}', \ 'menu' : '', 'info' : ''