mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
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:
|
||||
tree_node = func.tree_node
|
||||
if tree_node.type != 'funcdef':
|
||||
continue
|
||||
|
||||
for return_stmt in tree_node.iter_return_stmts():
|
||||
# Basically until the next comment we just try to find out if a
|
||||
# return statement looks exactly like `return getattr(x, name)`.
|
||||
|
||||
@@ -419,6 +419,13 @@ GetattrArray().something[0]
|
||||
#? []
|
||||
GetattrArray().something
|
||||
|
||||
class WeirdGetattr:
|
||||
class __getattr__():
|
||||
pass
|
||||
|
||||
#? []
|
||||
WeirdGetattr().something
|
||||
|
||||
|
||||
# -----------------
|
||||
# private vars
|
||||
|
||||
Reference in New Issue
Block a user