call_signatures instead of function_definition

This commit is contained in:
David Halter
2013-08-20 15:07:32 +04:30
parent 00814ef58d
commit bba9682197
3 changed files with 11 additions and 11 deletions

View File

@@ -26,8 +26,8 @@ function! jedi#completions(findstart, base)
endfunction endfunction
function! jedi#show_func_def() function! jedi#show_call_signatures()
Python jedi_vim.show_func_def() Python jedi_vim.show_call_signatures()
endfunction endfunction
function! jedi#enable_speed_debugging() function! jedi#enable_speed_debugging()
@@ -158,9 +158,9 @@ function! jedi#do_popup_on_dot()
return 1 return 1
endfunc endfunc
function! jedi#configure_function_definition() function! jedi#configure_call_signature()
autocmd InsertLeave <buffer> Python jedi_vim.clear_func_def() autocmd InsertLeave <buffer> Python jedi_vim.clear_call_signatures()
autocmd CursorMovedI <buffer> call jedi#show_func_def() autocmd CursorMovedI <buffer> call jedi#show_call_signatures()
endfunction endfunction
if has('python') if has('python')

View File

@@ -31,7 +31,7 @@ if g:jedi#auto_initialization
execute "nnoremap <silent> <buffer>".g:jedi#pydoc." :call jedi#show_pydoc()<CR>" execute "nnoremap <silent> <buffer>".g:jedi#pydoc." :call jedi#show_pydoc()<CR>"
if g:jedi#show_function_definition == 1 && has('conceal') if g:jedi#show_function_definition == 1 && has('conceal')
call jedi#configure_function_definition() call jedi#configure_call_signature()
endif endif
end end

View File

@@ -52,7 +52,7 @@ def get_script(source=None, column=None):
def completions(): def completions():
row, column = vim.current.window.cursor row, column = vim.current.window.cursor
clear_func_def() clear_call_signatures()
if vim.eval('a:findstart') == '1': if vim.eval('a:findstart') == '1':
count = 0 count = 0
for char in reversed(vim.current.line[:column]): for char in reversed(vim.current.line[:column]):
@@ -99,7 +99,7 @@ def completions():
call_def = None call_def = None
#print 'end', strout #print 'end', strout
show_func_def(call_def, len(completions)) show_call_signatures(call_def, len(completions))
vim.command('return ' + strout) vim.command('return ' + strout)
@@ -183,7 +183,7 @@ def show_pydoc():
vim.command('let l:doc_lines = %s' % len(text.split('\n'))) vim.command('let l:doc_lines = %s' % len(text.split('\n')))
def clear_func_def(): def clear_call_signatures():
cursor = vim.current.window.cursor cursor = vim.current.window.cursor
e = vim.eval('g:jedi#function_definition_escape') e = vim.eval('g:jedi#function_definition_escape')
regex = r'%sjedi=([0-9]+), ([^%s]*)%s.*%sjedi%s'.replace('%s', e) regex = r'%sjedi=([0-9]+), ([^%s]*)%s.*%sjedi%s'.replace('%s', e)
@@ -199,14 +199,14 @@ def clear_func_def():
vim.current.window.cursor = cursor vim.current.window.cursor = cursor
def show_func_def(call_def=None, completion_lines=0): def show_call_signatures(call_def=None, completion_lines=0):
if vim.eval("has('conceal') && g:jedi#show_function_definition") == '0': if vim.eval("has('conceal') && g:jedi#show_function_definition") == '0':
return return
try: try:
if call_def == None: if call_def == None:
sig = get_script().call_signatures() sig = get_script().call_signatures()
call_def = sig[0] if sig else None call_def = sig[0] if sig else None
clear_func_def() clear_call_signatures()
if call_def is None: if call_def is None:
return return