-
Notifications
You must be signed in to change notification settings - Fork 26
Description
In README.md, it was introduced:
Preview the function signature circularly in the command line:
PreviewSignature[!] [function name]
If the function name is not provided, current word under cursor will be taken as function name.
If bang ! sign is given, the nearest function name to the cursor position is chosen.But in the script, it was written:
function! s:PreviewSignature(bang, ...)
let funcname = (a:0 > 0)? a:1 : ""
if a:bang
let funcname = '<?>'
endif
call preview#function_echo(funcname, 0)
endfuncSeems that with a bang given, the first argument passed to preview#function_echo() will be '<?>'. And preview#function_echo() is just a simple wrapper around preview#function_define() by passing its first parameter to it. But when I digged a little deeper into that function, I noticed the following lines, which a:name is indeed funcname occurring above:
if a:name == ''
let name = preview#function_guess(line[0:endpos])
elseif a:name == '<?>'
let name = expand('<cword>')
else
let name = a:name
endifSurprisingly, if a;name is '<?>', which is the circumstance we expect to have a 'guess' about the nearest function name by giving a bang adhering the 'PreviewSignature' command, what the function does is only picking the word under the cursor. However without a bang, an inner function called preview#function_guess() would try to guess the nearest function name. The command just behave conversely against the documentation.