Fix parse parenthesis
This commit is contained in:
parent
12ad06d37d
commit
43438178b0
@ -107,7 +107,7 @@ function! neosnippet#handlers#_get_in_paren(str) abort "{{{
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
elseif c == ')'
|
elseif c == ')'
|
||||||
if level == 1
|
if level == 1 && s != ''
|
||||||
return s
|
return s
|
||||||
else
|
else
|
||||||
let level -= 1
|
let level -= 1
|
||||||
|
@ -2,15 +2,26 @@ let s:suite = themis#suite('toml')
|
|||||||
let s:assert = themis#helper('assert')
|
let s:assert = themis#helper('assert')
|
||||||
|
|
||||||
function! s:suite.get_in_paren()
|
function! s:suite.get_in_paren()
|
||||||
call s:assert.equals(neosnippet#handlers#_get_in_paren('(foobar)'),
|
call s:assert.equals(neosnippet#handlers#_get_in_paren(
|
||||||
|
\ '(foobar)'),
|
||||||
\ 'foobar')
|
\ 'foobar')
|
||||||
call s:assert.equals(neosnippet#handlers#_get_in_paren('(foobar, baz)'),
|
call s:assert.equals(neosnippet#handlers#_get_in_paren(
|
||||||
|
\ '(foobar, baz)'),
|
||||||
\ 'foobar, baz')
|
\ 'foobar, baz')
|
||||||
call s:assert.equals(neosnippet#handlers#_get_in_paren('(foobar, (baz))'),
|
call s:assert.equals(neosnippet#handlers#_get_in_paren(
|
||||||
|
\ '(foobar, (baz))'),
|
||||||
\ 'foobar, (baz)')
|
\ 'foobar, (baz)')
|
||||||
call s:assert.equals(neosnippet#handlers#_get_in_paren('foobar('),
|
call s:assert.equals(neosnippet#handlers#_get_in_paren(
|
||||||
|
\ 'foobar('),
|
||||||
\ '')
|
\ '')
|
||||||
call s:assert.equals(neosnippet#handlers#_get_in_paren('foobar(fname)'),
|
call s:assert.equals(neosnippet#handlers#_get_in_paren(
|
||||||
|
\ 'foobar()'),
|
||||||
|
\ '')
|
||||||
|
call s:assert.equals(neosnippet#handlers#_get_in_paren(
|
||||||
|
\ 'foobar(fname)'),
|
||||||
\ 'fname')
|
\ 'fname')
|
||||||
|
call s:assert.equals(neosnippet#handlers#_get_in_paren(
|
||||||
|
\ 'wait() wait(long, int)'),
|
||||||
|
\ 'long, int')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user