Improve completed snippet behavior

This commit is contained in:
Shougo Matsushita
2015-12-30 12:49:24 +09:00
parent 3e6f927854
commit 50a25a35a2
2 changed files with 23 additions and 4 deletions

View File

@@ -324,10 +324,12 @@ function! neosnippet#parser#_get_completed_snippet(completed_item) "{{{
for arg in split(substitute(
\ neosnippet#parser#_get_in_paren('<', '>', abbr),
\ '<\zs.\{-}\ze>', '', 'g'), '[^[]\zs\s*,\s*')
if args != ''
if args != '' && arg !=# '...'
let args .= ', '
endif
let args .= printf('${%d:#:%s}', cnt, escape(arg, '{}'))
let args .= printf('${%d:#:%s%s}',
\ cnt, ((args != '' && arg ==# '...') ? ', ' : ''),
\ escape(arg, '{}'))
let cnt += 1
endfor
let snippet .= args
@@ -343,10 +345,12 @@ function! neosnippet#parser#_get_completed_snippet(completed_item) "{{{
continue
endif
if args != ''
if args != '' && arg !=# '...'
let args .= ', '
endif
let args .= printf('${%d:#:%s}', cnt, escape(arg, '{}'))
let args .= printf('${%d:#:%s%s}',
\ cnt, ((args != '' && arg ==# '...') ? ', ' : ''),
\ escape(arg, '{}'))
let cnt += 1
endfor
let snippet .= args