module imports are working now

This commit is contained in:
David Halter
2012-04-09 00:27:10 +02:00
parent 2770c6779a
commit 401f8fb28f

View File

@@ -10,6 +10,9 @@ if !has('python')
finish
endif
" ------------------------------------------------------------------------
" Completion
" ------------------------------------------------------------------------
function! jedi#Complete(findstart, base)
if a:findstart == 1
@@ -17,17 +20,19 @@ function! jedi#Complete(findstart, base)
else
python << PYTHONEOF
if 1:
# TODO change the finstart column, to switch cases, if they are not right.
row, column = vim.current.window.cursor
buf_path = vim.current.buffer.name
source = '\n'.join(vim.current.buffer)
try:
completions = functions.complete(source, row, column)
completions = functions.complete(source, row, column, buf_path)
out = []
for c in completions:
d = dict(word=c.complete,
abbr=str(c),
menu=c.description, # stuff directly behind the completion
info=c.help, # docstr and similar stuff
kind=c.type, # completion type
kind=c.get_vim_type(), # completion type
icase=1, # case insensitive
dup=1, # allow duplicates (maybe later remove this)
)
@@ -35,10 +40,11 @@ if 1:
strout = str(out)
except Exception as e:
print 'error:', e
# print to stdout, will be in :messages
print(traceback.format_exc())
strout = ''
print 'end', strout
#print 'end', strout
vim.command('return ' + strout)
PYTHONEOF
endif
@@ -48,7 +54,7 @@ endfunction
" ------------------------------------------------------------------------
" Initialization of Jedi
" ------------------------------------------------------------------------
"
let s:current_file=expand("<sfile>")
python << PYTHONEOF
@@ -60,6 +66,8 @@ import sys
from os.path import dirname
sys.path.insert(0, dirname(dirname(vim.eval('s:current_file'))))
import traceback # for exception output
import functions
PYTHONEOF