Repository: PowerShell/PowerShell
File: src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs (C#)

Code before:
                {
                    if (isConstraint)
                    {
                        varInfo.LastDeclaredConstraint = variableType;
                    }
                    else
                    {
                        varInfo.LastAssignedType = variableType;
                    }
                }
                else
                {
                    varInfo = isConstraint
                        ? new VariableInfo() { LastDeclaredConstraint = variableType }
                        : new VariableInfo() { LastAssignedType = variableType };
                    VariableInfoTable.Add(variableName, varInfo);
                    FoundVariables.Add(variableName);
                }
            }

            public override AstVisitAction DefaultVisit(Ast ast)
            {
                if (ast.Extent.StartOffset > StopSearchOffset)
                {
                    // When visiting do while/until statements, the condition will be visited before the statement block
                    // The condition itself may not be interesting if it's after the cursor, but the statement block could be
                    return ast is PipelineBaseAst && ast.Parent is DoUntilStatementAst or DoWhileStatementAst
                        ? AstVisitAction.SkipChildren
                        : AstVisitAction.StopVisit;
                }

                return AstVisitAction.Continue;
            }

            public override AstVisitAction VisitAssignmentStatement(AssignmentStatementAst assignmentStatementAst)
            {
                if (assignmentStatementAst.Extent.StartOffset > StopSearchOffset)
                {
                    return assignmentStatementAst.Parent is DoUntilStatementAst or DoWhileStatementAst ?
                        AstVisitAction.SkipChildren
                        : AstVisitAction.StopVisit;
                }

                if (assignmentStatementAst.Left is AttributedExpressionAst attributedExpression)
                {
                    var firstConvertExpression = attributedExpression as ConvertExpressionAst;
                    ExpressionAst child = attributedExpression.Child;
                    while (child is AttributedExpressionAst attributeChild)
                    {
                        if (firstConvertExpression is null && attributeChild is ConvertExpressionAst convertExpression)
                        {

Review comment (suggestion):
```suggestion
                    // When visiting do while/until statements, the condition will be visited before the statement block.
                    // The condition itself may not be interesting if it's after the cursor, but the statement block could be.
```

Code after:
                {
                    if (isConstraint)
                    {
                        varInfo.LastDeclaredConstraint = variableType;
                    }
                    else
                    {
                        varInfo.LastAssignedType = variableType;
                    }
                }
                else
                {
                    varInfo = isConstraint
                        ? new VariableInfo() { LastDeclaredConstraint = variableType }
                        : new VariableInfo() { LastAssignedType = variableType };
                    VariableInfoTable.Add(variableName, varInfo);
                    FoundVariables.Add(variableName);
                }
            }

            public override AstVisitAction DefaultVisit(Ast ast)
            {
                if (ast.Extent.StartOffset > StopSearchOffset)
                {
                    // When visiting do while/until statements, the condition will be visited before the statement block.
                    // The condition itself may not be interesting if it's after the cursor, but the statement block could be.
                    return ast is PipelineBaseAst && ast.Parent is DoUntilStatementAst or DoWhileStatementAst
                        ? AstVisitAction.SkipChildren
                        : AstVisitAction.StopVisit;
                }

                return AstVisitAction.Continue;
            }

            public override AstVisitAction VisitAssignmentStatement(AssignmentStatementAst assignmentStatementAst)
            {
                if (assignmentStatementAst.Extent.StartOffset > StopSearchOffset)
                {
                    return assignmentStatementAst.Parent is DoUntilStatementAst or DoWhileStatementAst ?
                        AstVisitAction.SkipChildren
                        : AstVisitAction.StopVisit;
                }

                if (assignmentStatementAst.Left is AttributedExpressionAst attributedExpression)
                {
                    var firstConvertExpression = attributedExpression as ConvertExpressionAst;
                    ExpressionAst child = attributedExpression.Child;
                    while (child is AttributedExpressionAst attributeChild)
                    {
                        if (firstConvertExpression is null && attributeChild is ConvertExpressionAst convertExpression)
                        {