From 13c51ee885216619ab2dcd1a2c3790b83f85f27c Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Mon, 9 Jan 2017 18:19:16 +0900 Subject: [PATCH] Fix #368 select commas --- autoload/neosnippet/parser.vim | 10 ++-------- test/functions.vim | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/autoload/neosnippet/parser.vim b/autoload/neosnippet/parser.vim index c453e42..308b39d 100644 --- a/autoload/neosnippet/parser.vim +++ b/autoload/neosnippet/parser.vim @@ -359,11 +359,8 @@ function! neosnippet#parser#_get_completed_snippet(completed_item, cur_text, nex for arg in split(substitute( \ neosnippet#parser#_get_in_paren('<', '>', abbr), \ '<\zs.\{-}\ze>', '', 'g'), '[^[]\zs\s*,\s*') - if args != '' && arg !=# '...' - let args .= ', ' - endif let args .= printf('${%d:#:%s%s}', - \ cnt, ((args != '' && arg ==# '...') ? ', ' : ''), + \ cnt, ((args != '') ? ', ' : ''), \ escape(arg, '{}')) let cnt += 1 endfor @@ -385,11 +382,8 @@ function! neosnippet#parser#_get_completed_snippet(completed_item, cur_text, nex continue endif - if args != '' && arg !=# '...' - let args .= ', ' - endif let args .= printf('${%d:#:%s%s}', - \ cnt, ((args != '' && arg ==# '...') ? ', ' : ''), + \ cnt, ((args != '') ? ', ' : ''), \ escape(arg, '{}')) let cnt += 1 endfor diff --git a/test/functions.vim b/test/functions.vim index 39491a2..d1f6db9 100644 --- a/test/functions.vim +++ b/test/functions.vim @@ -65,12 +65,12 @@ function! s:suite.get_completed_snippet() abort call s:assert.equals(neosnippet#parser#_get_completed_snippet({ \ 'word' : 'foo(', 'abbr' : 'foo(hoge, piyo)', \ 'menu' : '', 'info' : '' - \ }, 'foo(', ''), '${1:#:hoge}, ${2:#:piyo})${3}') + \ }, 'foo(', ''), '${1:#:hoge}${2:#:, piyo})${3}') call s:assert.equals(neosnippet#parser#_get_completed_snippet({ \ 'word' : 'foo(', 'abbr' : 'foo(hoge, piyo(foobar))', \ 'menu' : '', 'info' : '' - \ }, 'foo(', ''), '${1:#:hoge}, ${2:#:piyo()})${3}') + \ }, 'foo(', ''), '${1:#:hoge}${2:#:, piyo()})${3}') call s:assert.equals(neosnippet#parser#_get_completed_snippet({ \ 'word' : 'foo(', 'abbr' : 'foo(hoge[, abc])', @@ -100,7 +100,7 @@ function! s:suite.get_completed_snippet() abort call s:assert.equals(neosnippet#parser#_get_completed_snippet({ \ 'word' : 'Dictionary', 'abbr' : 'Dictionary(foo)', \ 'menu' : '', 'info' : '' - \ }, 'Dictionary', ''), '<${1:#:Key}, ${2:#:Value}>(${3:#:foo})${4}') + \ }, 'Dictionary', ''), '<${1:#:Key}${2:#:, Value}>(${3:#:foo})${4}') call s:assert.equals(neosnippet#parser#_get_completed_snippet({ \ 'word' : 'Dictionary(',