GeezerVison is showing github.com — Add PEP 526 AutoCompletion (#1102) · adInfimum/vscode-python@ad563ee
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: pythonFiles/preview/jedi/evaluate/__init__.py +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -162,7 +162,7 @@ def eval_statement(self, stmt, seek_name=None): |
162 | 162 | types = finder.check_tuple_assignments(self, types, seek_name) |
163 | 163 |
|
164 | 164 | first_operation = stmt.first_operation() |
165 | | - if first_operation not in ('=', None) and not isinstance(stmt, er.InstanceElement): # TODO don't check for this. |
| 165 | + if first_operation not in ('=', None) and not isinstance(stmt, er.InstanceElement) and first_operation.type == 'operator': # TODO don't check for this. |
166 | 166 | # `=` is always the last character in aug assignments -> -1 |
167 | 167 | operator = copy.copy(first_operation) |
168 | 168 | operator.value = operator.value[:-1] |
@@ -327,6 +327,8 @@ def _eval_element_not_cached(self, element): |
327 | 327 | types = types |
328 | 328 | elif element.type == 'eval_input': |
329 | 329 | types = self._eval_element_not_cached(element.children[0]) |
| 330 | + elif element.type == 'annassign': |
| 331 | + types = self.eval_element(element.children[1]) |
330 | 332 | else: |
331 | 333 | types = precedence.calculate_children(self, element.children) |
332 | 334 | debug.dbg('eval_element result %s', types) |
|
Collapse file
Copy file name to clipboardExpand all lines: pythonFiles/preview/jedi/parser/tree.py +8-3Lines changed: 8 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1522,9 +1522,14 @@ class ExprStmt(BaseNode, DocstringMixin): |
1522 | 1522 | __slots__ = () |
1523 | 1523 |
|
1524 | 1524 | def get_defined_names(self): |
1525 | | - return list(chain.from_iterable(_defined_names(self.children[i]) |
1526 | | - for i in range(0, len(self.children) - 2, 2) |
1527 | | - if '=' in self.children[i + 1].value)) |
| 1525 | + names = [] |
| 1526 | + if self.children[1].type == 'annassign': |
| 1527 | + names = _defined_names(self.children[0]) |
| 1528 | + return list(chain.from_iterable( |
| 1529 | + _defined_names(self.children[i]) |
| 1530 | + for i in range(0, len(self.children) - 2, 2) |
| 1531 | + if '=' in self.children[i + 1].value) |
| 1532 | + ) + names |
1528 | 1533 |
|
1529 | 1534 | def get_rhs(self): |
1530 | 1535 | """Returns the right-hand-side of the equals.""" |
|