1
0
forked from VimPlug/jedi

added much nicer descriptions for the completion. fixes #49

This commit is contained in:
David Halter
2012-11-08 00:48:26 +01:00
parent 5c33b6c3c2
commit 8dd9952288
2 changed files with 37 additions and 26 deletions
+15 -9
View File
@@ -249,12 +249,12 @@ class Scope(Simple):
def __repr__(self):
try:
name = self.name
name = self.path
except AttributeError:
try:
name = self.command
name = self.name
except AttributeError:
name = self.path
name = self.command
return "<%s: %s@%s-%s>" % (type(self).__name__, name,
self.start_pos[0], self.end_pos[0])
@@ -289,16 +289,22 @@ class Module(Scope):
n += self.global_vars
return n
def get_name(self):
@property
def name(self):
""" This is used for the goto function. """
sep = (os.path.sep,) * 2
r = re.search(r'([^%s]+?)(%s__init__)?(\.py)?$' % sep, self.path)
string = r.group(1)
if self._name is not None:
return self._name
if self.path is None:
string = '' # no path -> empty name
else:
sep = (os.path.sep,) * 2
r = re.search(r'([^%s]+?)(%s__init__)?(\.py)?$' % sep, self.path)
string = r.group(1)
names = [(string, (0, 0))]
if not self._name:
self._name = Name(names, self.start_pos, self.end_pos, self)
self._name = Name(names, self.start_pos, self.end_pos, self)
return self._name
def is_builtin(self):
return not (self.path is None or self.path.endswith('.py'))