Fix #322 completed snippet error for < Foo,Fee> in ()
This commit is contained in:
parent
3db55f354d
commit
58fa466f7e
@ -47,7 +47,10 @@ call neosnippet#util#set_default(
|
||||
call neosnippet#util#set_default(
|
||||
\ 'g:neosnippet#enable_auto_clear_markers', 1)
|
||||
call neosnippet#util#set_default(
|
||||
\ 'g:neosnippet#completed_pairs',{'_':{ '(' : ')', '{' : '}', '"' : '"' }})
|
||||
\ 'g:neosnippet#completed_pairs', {})
|
||||
call neosnippet#util#set_default(
|
||||
\ 'g:neosnippet#_completed_pairs',
|
||||
\ {'_':{ '(' : ')', '{' : '}', '"' : '"' }})
|
||||
"}}}
|
||||
|
||||
function! neosnippet#expandable_or_jumpable() "{{{
|
||||
|
@ -304,11 +304,9 @@ function! neosnippet#parser#_get_completed_snippet(completed_item, next_text) "{
|
||||
if item.info != ''
|
||||
let abbr = split(item.info, '\n')[0]
|
||||
endif
|
||||
if index(keys(g:neosnippet#completed_pairs),expand(&ft)) < 0
|
||||
let pairs = g:neosnippet#completed_pairs._
|
||||
else
|
||||
let pairs = g:neosnippet#completed_pairs[expand(&ft)]
|
||||
endif
|
||||
let pairs = neosnippet#util#get_buffer_config(
|
||||
\ &filetype, '',
|
||||
\ 'g:neosnippet#completed_pairs', 'g:neosnippet#_completed_pairs', {})
|
||||
let word_pattern = neosnippet#util#escape_pattern(item.word)
|
||||
let angle_pattern = word_pattern . '<.\+>(.*)'
|
||||
let no_key = index(keys(pairs), item.word[-1:]) < 0
|
||||
@ -366,7 +364,8 @@ function! neosnippet#parser#_get_completed_snippet(completed_item, next_text) "{
|
||||
let args = ''
|
||||
for arg in split(substitute(
|
||||
\ neosnippet#parser#_get_in_paren(key, pair, abbr),
|
||||
\ key.'\zs.\{-}\ze'.pair, '', 'g'), '[^[]\zs\s*,\s*')
|
||||
\ key.'\zs.\{-}\ze'.pair . '\|<\zs.\{-}\ze>', '', 'g'),
|
||||
\ '[^[]\zs\s*,\s*')
|
||||
if key ==# '(' && arg ==# 'self' && &filetype ==# 'python'
|
||||
" Ignore self argument
|
||||
continue
|
||||
|
@ -123,5 +123,10 @@ function! s:suite.get_completed_snippet()
|
||||
\ 'word' : 'Dictionary', 'abbr' : 'Dictionary(foo)',
|
||||
\ 'menu' : '', 'info' : ''
|
||||
\ }, ''), '(${1:#:foo})${2}')
|
||||
|
||||
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
||||
\ 'word' : 'forEach', 'abbr' : 'forEach(BiConsumer<Object, Object>)',
|
||||
\ 'menu' : '', 'info' : ''
|
||||
\ }, ''), '(${1:#:BiConsumer<>})${2}')
|
||||
endfunction
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user