forked from VimPlug/jedi
better type description of completion
This commit is contained in:
13
jedi/api.py
13
jedi/api.py
@@ -78,10 +78,15 @@ class Completion(object):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def get_type(self):
|
@property
|
||||||
""" Returns the type of a completion object (e.g. Function/Class
|
def type(self):
|
||||||
TODO please don't use yet, behaviour may change in the future. """
|
""" Returns the type of a completion object (e.g. Function/Class) """
|
||||||
return type(self.name.parent())
|
if self.name.parent is None:
|
||||||
|
return ''
|
||||||
|
name_type = self.name.parent()
|
||||||
|
if isinstance(self.name_type, evaluate.InstanceElement):
|
||||||
|
name_type = name_type.var
|
||||||
|
return type(self.name_var).__class__
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<%s: %s>' % (type(self).__name__, self.name)
|
return '<%s: %s>' % (type(self).__name__, self.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user