Pyimport command should respect tab setting

This commit is contained in:
David Halter
2013-08-22 10:47:13 +04:30
parent a74c3bd29a
commit 748a47e6e9
3 changed files with 12 additions and 16 deletions

2
jedi

Submodule jedi updated: 80ec8da513...2f3304b9f1

View File

@@ -79,8 +79,8 @@ if g:jedi#auto_initialization
autocmd FileType Python setlocal omnifunc=jedi#completions switchbuf=useopen " needed for documentation/pydoc
endif
fun! Pyimport(cmd, args)
py << EOF
fun! Pyimport(args)
Python << EOF
# args are the same as for the :edit command
# cmd: one of edit, split, vsplit, tabedit, ...
if 1:
@@ -99,12 +99,12 @@ if 1:
path = None
if path and osp.isfile(path):
cmd_args = ' '.join([a.replace(' ', '\\ ') for a in args])
vim.command('%s %s %s' % (cmd, cmd_args , path.replace(' ', '\ ')))
vim.eval("jedi#new_buffer('%s')" % path)
EOF
endfun
fun! Pyimport_comp(argl, cmdl, pos)
py << EOF
fun! Pyimport_completion(argl, cmdl, pos)
Python << EOF
if 1:
import vim
import re
@@ -124,8 +124,5 @@ EOF
return comps
endfun
command! -nargs=1 -complete=custom,Pyimport_comp Pyimport :call Pyimport('edit', <q-args>)
" command! -nargs=1 -complete=custom,Pyimport_comp Pysplit :call Pyimport('split', <q-args>)
" command! -nargs=1 -complete=custom,Pyimport_comp Pyvsplit :call Pyimport('vsplit', <q-args>)
" command! -nargs=1 -complete=custom,Pyimport_comp Pytabe :call Pyimport('tabe', <q-args>)
command! -nargs=1 -complete=custom,Pyimport_completion Pyimport :call Pyimport(<q-args>)
" vim: set et ts=4:

View File

@@ -75,8 +75,7 @@ def completions():
try:
script = get_script(source=source, column=column)
completions = script.completions()
sig = script.call_signatures()
call_def = sig[0] if sig else None
signatures = script.call_signatures()
out = []
for c in completions:
@@ -96,10 +95,10 @@ def completions():
print(traceback.format_exc())
strout = ''
completions = []
call_def = None
signatures = []
#print 'end', strout
show_call_signatures(call_def, len(completions))
show_call_signatures(signatures, len(completions))
vim.command('return ' + strout)
@@ -199,11 +198,11 @@ def clear_call_signatures():
vim.current.window.cursor = cursor
def show_call_signatures(call_def=None, completion_lines=0):
def show_call_signatures(signatures=()):
if vim.eval("has('conceal') && g:jedi#show_call_signatures") == '0':
return
try:
if call_def == None:
if signatures == None:
sig = get_script().call_signatures()
call_def = sig[0] if sig else None
clear_call_signatures()