deprecate a lot of old definitions how to use functions, use instead the names of jedi functions

This commit is contained in:
David Halter
2013-08-20 16:17:39 +04:30
parent 99b53f200f
commit 6ed0b78c90
5 changed files with 48 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
if g:jedi#show_function_definition == 1 && has('conceal') if g:jedi#show_call_signatures == 1 && has('conceal')
" conceal is normal for vim >= 7.3 " conceal is normal for vim >= 7.3
let e = g:jedi#function_definition_escape let e = g:jedi#function_definition_escape

View File

@@ -11,7 +11,7 @@ function! jedi#get_definition()
endfunction endfunction
function! jedi#related_names() function! jedi#usages()
Python jedi_vim.goto(is_related_name=True) Python jedi_vim.goto(is_related_name=True)
endfunction endfunction
@@ -43,10 +43,10 @@ function! jedi#disable_debugging()
endfunction endfunction
" ------------------------------------------------------------------------ " ------------------------------------------------------------------------
" show_pydoc " show_documentation
" ------------------------------------------------------------------------ " ------------------------------------------------------------------------
function! jedi#show_pydoc() function! jedi#show_documentation()
Python jedi_vim.show_pydoc() Python jedi_vim.show_documentation()
if bufnr("__doc__") > 0 if bufnr("__doc__") > 0
" If the __doc__ buffer is open in the current window, jump to it " If the __doc__ buffer is open in the current window, jump to it
silent execute "sbuffer ".bufnr("__doc__") silent execute "sbuffer ".bufnr("__doc__")
@@ -158,7 +158,7 @@ function! jedi#do_popup_on_dot()
return 1 return 1
endfunc endfunc
function! jedi#configure_call_signature() function! jedi#configure_call_signatures()
autocmd InsertLeave <buffer> Python jedi_vim.clear_call_signatures() autocmd InsertLeave <buffer> Python jedi_vim.clear_call_signatures()
autocmd CursorMovedI <buffer> call jedi#show_call_signatures() autocmd CursorMovedI <buffer> call jedi#show_call_signatures()
endfunction endfunction

View File

@@ -11,7 +11,7 @@ if g:jedi#auto_initialization
setlocal omnifunc=jedi#completions setlocal omnifunc=jedi#completions
" map ctrl+space for autocompletion " map ctrl+space for autocompletion
if g:jedi#autocompletion_command == "<C-Space>" if g:jedi#completions_command == "<C-Space>"
" in terminals, <C-Space> sometimes equals <Nul> " in terminals, <C-Space> sometimes equals <Nul>
inoremap <expr> <Nul> pumvisible() \|\| &omnifunc == '' ? inoremap <expr> <Nul> pumvisible() \|\| &omnifunc == '' ?
\ "\<lt>C-n>" : \ "\<lt>C-n>" :
@@ -19,19 +19,19 @@ if g:jedi#auto_initialization
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" . \ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>" \ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
endif endif
execute "inoremap <buffer>".g:jedi#autocompletion_command." <C-X><C-O>" execute "inoremap <buffer>".g:jedi#completions_command." <C-X><C-O>"
" goto / get_definition / related_names " goto / get_definition / related_names
execute "noremap <buffer>".g:jedi#goto_command." :call jedi#goto()<CR>" execute "noremap <buffer>".g:jedi#goto_assignments_command." :call jedi#goto()<CR>"
execute "noremap <buffer>".g:jedi#get_definition_command." :call jedi#get_definition()<CR>" execute "noremap <buffer>".g:jedi#goto_definitions_command." :call jedi#get_definition()<CR>"
execute "noremap <buffer>".g:jedi#related_names_command." :call jedi#related_names()<CR>" execute "noremap <buffer>".g:jedi#usages_command." :call jedi#related_names()<CR>"
" rename " rename
execute "noremap <buffer>".g:jedi#rename_command." :call jedi#rename()<CR>" execute "noremap <buffer>".g:jedi#rename_command." :call jedi#rename()<CR>"
" pydoc " documentation/pydoc
execute "nnoremap <silent> <buffer>".g:jedi#pydoc." :call jedi#show_pydoc()<CR>" execute "nnoremap <silent> <buffer>".g:jedi#documentation_command." :call jedi#show_documentation()<CR>"
if g:jedi#show_function_definition == 1 && has('conceal') if g:jedi#show_call_signatures == 1 && has('conceal')
call jedi#configure_call_signature() call jedi#configure_call_signatures()
endif endif
end end

View File

@@ -17,21 +17,45 @@ if exists("g:loaded_jedi") || &cp
endif endif
let g:loaded_jedi = 1 let g:loaded_jedi = 1
" ------------------------------------------------------------------------
" deprecations
" ------------------------------------------------------------------------
let s:deprecations = {
\ 'get_definition_command': 'goto_definitions_command',
\ 'goto_command': 'goto_assignments_command',
\ 'pydoc': 'documentation_command',
\ 'related_names_command': 'usages_command',
\ 'autocompletion_command': 'completions_command',
\ 'show_function_definition': 'show_call_signatures',
}
for [key, val] in items(s:settings)
if exists('g:jedi#'.key)
echom "'g:jedi#".key."' is deprecated. Please use 'g:jedi#".value."' instead. Sorry for the inconvenience."
exe 'let g:jedi#'.val.' = g:jedi#'.key
end
endfor
" ------------------------------------------------------------------------ " ------------------------------------------------------------------------
" defaults for jedi-vim " defaults for jedi-vim
" ------------------------------------------------------------------------ " ------------------------------------------------------------------------
let s:settings = { let s:settings = {
\ 'use_tabs_not_buffers': 1, \ 'use_tabs_not_buffers': 1,
\ 'auto_initialization': 1, \ 'auto_initialization': 1,
\ 'auto_vim_configuration': 1, \ 'auto_vim_configuration': 1,
\ 'goto_command': "'<leader>g'", \ 'goto_assignments_command': "'<leader>g'",
\ 'autocompletion_command': "'<C-Space>'", \ 'completions_command': "'<C-Space>'",
\ 'get_definition_command': "'<leader>d'", \ 'goto_definitions_command': "'<leader>d'",
\ 'related_names_command': "'<leader>n'", \ 'call_signatures_command': "'<leader>n'",
\ 'usages_command': "'<leader>n'",
\ 'rename_command': "'<leader>r'", \ 'rename_command': "'<leader>r'",
\ 'popup_on_dot': 1, \ 'popup_on_dot': 1,
\ 'pydoc': "'K'", \ 'documentation_command': "'K'",
\ 'show_function_definition': 1, \ 'show_call_signatures': 1,
\ 'call_signature_escape': "'≡'", \ 'call_signature_escape': "'≡'",
\ 'auto_close_doc': 1, \ 'auto_close_doc': 1,
\ 'popup_select_first': 1, \ 'popup_select_first': 1,
@@ -52,7 +76,7 @@ if g:jedi#auto_initialization
" this is only here because in some cases the VIM library adds their " this is only here because in some cases the VIM library adds their
" autocompletion as a default, which may cause problems, depending on the " autocompletion as a default, which may cause problems, depending on the
" order of invocation. " order of invocation.
autocmd FileType Python setlocal omnifunc=jedi#completions switchbuf=useopen " needed for pydoc autocmd FileType Python setlocal omnifunc=jedi#completions switchbuf=useopen " needed for documentation/pydoc
endif endif
fun! Pyimport(cmd, args) fun! Pyimport(cmd, args)

View File

@@ -161,7 +161,7 @@ def goto(is_definition=False, is_related_name=False, no_output=False):
return definitions return definitions
def show_pydoc(): def show_documentation():
script = get_script() script = get_script()
try: try:
definitions = script.goto_definitions() definitions = script.goto_definitions()
@@ -200,7 +200,7 @@ def clear_call_signatures():
def show_call_signatures(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_call_signatures") == '0':
return return
try: try:
if call_def == None: if call_def == None: