mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-19 20:27:45 +03:00
When hovering over the LHS of an augmented assignment (e.g. the a
within a += x
), reveal the type of the symbol _after_ the operation rather than _before_.
This commit is contained in:
parent
7d050c49bb
commit
8a69070892
@ -95,6 +95,12 @@ export function findNodeByOffset(node: ParseNode, offset: number): ParseNode | u
|
||||
if (child) {
|
||||
const containingChild = findNodeByOffset(child, offset);
|
||||
if (containingChild) {
|
||||
// For augmented assignments, prefer the dest expression, which is a clone
|
||||
// of the left expression but is used to hold the type of the operation result.
|
||||
if (node.nodeType === ParseNodeType.AugmentedAssignment && containingChild === node.leftExpression) {
|
||||
return node.destExpression;
|
||||
}
|
||||
|
||||
return containingChild;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user