mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-06 10:54:22 +08:00
Pyimport command should respect tab setting
This commit is contained in:
2
jedi
2
jedi
Submodule jedi updated: 80ec8da513...2f3304b9f1
@@ -79,8 +79,8 @@ if g:jedi#auto_initialization
|
|||||||
autocmd FileType Python setlocal omnifunc=jedi#completions switchbuf=useopen " needed for documentation/pydoc
|
autocmd FileType Python setlocal omnifunc=jedi#completions switchbuf=useopen " needed for documentation/pydoc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
fun! Pyimport(cmd, args)
|
fun! Pyimport(args)
|
||||||
py << EOF
|
Python << EOF
|
||||||
# args are the same as for the :edit command
|
# args are the same as for the :edit command
|
||||||
# cmd: one of edit, split, vsplit, tabedit, ...
|
# cmd: one of edit, split, vsplit, tabedit, ...
|
||||||
if 1:
|
if 1:
|
||||||
@@ -99,12 +99,12 @@ if 1:
|
|||||||
path = None
|
path = None
|
||||||
if path and osp.isfile(path):
|
if path and osp.isfile(path):
|
||||||
cmd_args = ' '.join([a.replace(' ', '\\ ') for a in args])
|
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
|
EOF
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
fun! Pyimport_comp(argl, cmdl, pos)
|
fun! Pyimport_completion(argl, cmdl, pos)
|
||||||
py << EOF
|
Python << EOF
|
||||||
if 1:
|
if 1:
|
||||||
import vim
|
import vim
|
||||||
import re
|
import re
|
||||||
@@ -124,8 +124,5 @@ EOF
|
|||||||
return comps
|
return comps
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
command! -nargs=1 -complete=custom,Pyimport_comp Pyimport :call Pyimport('edit', <q-args>)
|
command! -nargs=1 -complete=custom,Pyimport_completion Pyimport :call Pyimport(<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>)
|
|
||||||
" vim: set et ts=4:
|
" vim: set et ts=4:
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ def completions():
|
|||||||
try:
|
try:
|
||||||
script = get_script(source=source, column=column)
|
script = get_script(source=source, column=column)
|
||||||
completions = script.completions()
|
completions = script.completions()
|
||||||
sig = script.call_signatures()
|
signatures = script.call_signatures()
|
||||||
call_def = sig[0] if sig else None
|
|
||||||
|
|
||||||
out = []
|
out = []
|
||||||
for c in completions:
|
for c in completions:
|
||||||
@@ -96,10 +95,10 @@ def completions():
|
|||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
strout = ''
|
strout = ''
|
||||||
completions = []
|
completions = []
|
||||||
call_def = None
|
signatures = []
|
||||||
|
|
||||||
#print 'end', strout
|
#print 'end', strout
|
||||||
show_call_signatures(call_def, len(completions))
|
show_call_signatures(signatures, len(completions))
|
||||||
vim.command('return ' + strout)
|
vim.command('return ' + strout)
|
||||||
|
|
||||||
|
|
||||||
@@ -199,11 +198,11 @@ def clear_call_signatures():
|
|||||||
vim.current.window.cursor = cursor
|
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':
|
if vim.eval("has('conceal') && g:jedi#show_call_signatures") == '0':
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
if call_def == None:
|
if signatures == 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_call_signatures()
|
clear_call_signatures()
|
||||||
|
|||||||
Reference in New Issue
Block a user