More fixup
This commit is contained in:
parent
c856cacfa7
commit
0b4d014c2e
@ -1,4 +1,4 @@
|
|||||||
Foo(a, b, c)
|
Foo(a, [b, z], c)
|
||||||
|
|
||||||
Foo(
|
Foo(
|
||||||
a,
|
a,
|
||||||
@ -15,7 +15,7 @@ Foo(
|
|||||||
a,
|
a,
|
||||||
[
|
[
|
||||||
b,
|
b,
|
||||||
c
|
"c"
|
||||||
],
|
],
|
||||||
d
|
d
|
||||||
)
|
)
|
||||||
|
15
wrap.vim
15
wrap.vim
@ -47,7 +47,10 @@ function! ExtractText(range)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if l:extractStart < l:extractEnd
|
if l:extractStart < l:extractEnd
|
||||||
let l:text .= l:lineText[l:extractStart : l:extractEnd - 1]
|
let l:extract = l:lineText[l:extractStart : l:extractEnd - 1]
|
||||||
|
let l:extract = substitute(l:extract, "^\\s\\+", "", "g")
|
||||||
|
let l:extract = substitute(l:extract, ",$", ", ", "g")
|
||||||
|
let l:text .= l:extract
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -65,6 +68,12 @@ function! UpdateScopeStack(stack, char)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! StripArgument(text)
|
||||||
|
let l:stripped = substitute(a:text, "\\s\\+", "", "")
|
||||||
|
let l:stripped = substitute(l:stripped, "^\\s\\+", "", "")
|
||||||
|
return l:stripped
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ExtractArguments(text)
|
function! ExtractArguments(text)
|
||||||
let l:stack = []
|
let l:stack = []
|
||||||
let l:arguments = []
|
let l:arguments = []
|
||||||
@ -75,14 +84,14 @@ function! ExtractArguments(text)
|
|||||||
call UpdateScopeStack(l:stack, l:char)
|
call UpdateScopeStack(l:stack, l:char)
|
||||||
|
|
||||||
if len(l:stack) == 0 && l:char == ","
|
if len(l:stack) == 0 && l:char == ","
|
||||||
call add(l:arguments, l:argument)
|
call add(l:arguments, StripArgument(l:argument))
|
||||||
let l:argument = ""
|
let l:argument = ""
|
||||||
else
|
else
|
||||||
let l:argument .= l:char
|
let l:argument .= l:char
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
call add(l:arguments, l:argument)
|
call add(l:arguments, StripArgument(l:argument))
|
||||||
return l:arguments
|
return l:arguments
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user