diff --git a/functions.py b/functions.py index 25e31eb3..d2aa0bdf 100644 --- a/functions.py +++ b/functions.py @@ -30,12 +30,16 @@ class Completion(object): dot = '.' if self.needs_dot else '' return dot + self.name.names[-1][self.like_name_length:] + @property + def word(self): + return str(self.name.names[-1]) + @property def description(self): return str(self.name.parent()) @property - def help(self): + def doc(self): try: return str(self.name.parent().docstr) except AttributeError: @@ -65,9 +69,6 @@ class Completion(object): return '' - def __str__(self): - return self.name.names[-1] - class Definition(object): def __init__(self, definition): diff --git a/plugin/jedi.vim b/plugin/jedi.vim index 949d78bb..ee9e5ea9 100644 --- a/plugin/jedi.vim +++ b/plugin/jedi.vim @@ -48,14 +48,14 @@ if 1: completions = functions.complete(source, row, column, buf_path) out = [] for c in completions: - d = dict(word=str(c), - abbr=str(c), + d = dict(word=base + c.complete, + abbr=c.word, # stuff directly behind the completion menu=PythonToVimStr(c.description), - info=PythonToVimStr(c.help), # docstr + info=PythonToVimStr(c.doc), # docstr kind=c.get_vim_type(), # completion type icase=1, # case insensitive - dup=1, # allow duplicates (maybe later remove this) + dup=1 # allow duplicates (maybe later remove this) ) out.append(d)