forked from VimPlug/jedi
Fix getattr completions on very weird cases, fixes #1573
This commit is contained in:
@@ -586,6 +586,9 @@ def _complete_getattr(user_context, instance):
|
|||||||
)
|
)
|
||||||
for func in functions:
|
for func in functions:
|
||||||
tree_node = func.tree_node
|
tree_node = func.tree_node
|
||||||
|
if tree_node.type != 'funcdef':
|
||||||
|
continue
|
||||||
|
|
||||||
for return_stmt in tree_node.iter_return_stmts():
|
for return_stmt in tree_node.iter_return_stmts():
|
||||||
# Basically until the next comment we just try to find out if a
|
# Basically until the next comment we just try to find out if a
|
||||||
# return statement looks exactly like `return getattr(x, name)`.
|
# return statement looks exactly like `return getattr(x, name)`.
|
||||||
|
|||||||
@@ -419,6 +419,13 @@ GetattrArray().something[0]
|
|||||||
#? []
|
#? []
|
||||||
GetattrArray().something
|
GetattrArray().something
|
||||||
|
|
||||||
|
class WeirdGetattr:
|
||||||
|
class __getattr__():
|
||||||
|
pass
|
||||||
|
|
||||||
|
#? []
|
||||||
|
WeirdGetattr().something
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# private vars
|
# private vars
|
||||||
|
|||||||
Reference in New Issue
Block a user