Fix completed snippet behavior
This commit is contained in:
		
							parent
							
								
									a323d8255a
								
							
						
					
					
						commit
						232d2e8def
					
				@ -50,7 +50,7 @@ call neosnippet#util#set_default(
 | 
			
		||||
      \ 'g:neosnippet#completed_pairs', {})
 | 
			
		||||
call neosnippet#util#set_default(
 | 
			
		||||
      \ 'g:neosnippet#_completed_pairs',
 | 
			
		||||
      \ {'_':{ '(' : ')', '{' : '}', '"' : '"' }})
 | 
			
		||||
      \ {'_':{ '(' : ')', '{' : '}', '"' : '"', '[' : ']' }})
 | 
			
		||||
"}}}
 | 
			
		||||
 | 
			
		||||
function! neosnippet#expandable_or_jumpable() "{{{
 | 
			
		||||
 | 
			
		||||
@ -381,6 +381,11 @@ function! neosnippet#parser#_get_completed_snippet(completed_item, next_text) "{
 | 
			
		||||
  endfor
 | 
			
		||||
  let snippet .= args
 | 
			
		||||
 | 
			
		||||
  if key != '(' && snippet == ''
 | 
			
		||||
    let snippet .= '${' . cnt . '}'
 | 
			
		||||
    let cnt += 1
 | 
			
		||||
  endif
 | 
			
		||||
 | 
			
		||||
  let snippet .= pair
 | 
			
		||||
  let snippet .= '${' . cnt . '}'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -78,11 +78,6 @@ function! s:suite.get_completed_snippet()
 | 
			
		||||
        \ 'menu' : '', 'info' : ''
 | 
			
		||||
        \ }, ''), '${1:#:hoge}${2:#:, ...})${3}')
 | 
			
		||||
 | 
			
		||||
  call s:assert.equals(neosnippet#parser#_get_completed_snippet({
 | 
			
		||||
        \ 'word' : 'foo{', 'abbr' : 'foo{}',
 | 
			
		||||
        \ 'menu' : '', 'info' : ''
 | 
			
		||||
        \ }, ''), '}${1}')
 | 
			
		||||
 | 
			
		||||
  call s:assert.equals(neosnippet#parser#_get_completed_snippet({
 | 
			
		||||
        \ 'word' : 'foo{', 'abbr' : 'foo{',
 | 
			
		||||
        \ 'menu' : '', 'info' : ''
 | 
			
		||||
@ -128,5 +123,10 @@ function! s:suite.get_completed_snippet()
 | 
			
		||||
        \ 'word' : 'forEach', 'abbr' : 'forEach(BiConsumer<Object, Object>)',
 | 
			
		||||
        \ 'menu' : '', 'info' : ''
 | 
			
		||||
        \ }, ''), '(${1:#:BiConsumer<>})${2}')
 | 
			
		||||
 | 
			
		||||
  call s:assert.equals(neosnippet#parser#_get_completed_snippet({
 | 
			
		||||
        \ 'word' : 'for[', 'abbr' : '',
 | 
			
		||||
        \ 'menu' : '', 'info' : ''
 | 
			
		||||
        \ }, ''), '${1}]${2}')
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user