diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index 7c558db5..4bcd3844 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -255,8 +255,11 @@ class Name(Leaf): def is_definition(self): stmt = self.get_definition() - return isinstance(stmt, (ExprStmt, Import)) \ - and self in stmt.get_defined_names() + if isinstance(stmt, (Function, Class, Module)): + return True + else: + return isinstance(stmt, (ExprStmt, Import)) \ + and self in stmt.get_defined_names() def assignment_indexes(self): """