Repository: dotnet/roslyn
File: src/Features/CSharp/Portable/EditAndContinue/BreakpointSpans.cs (C#)

Code before:
        }

        if (declarationStatement.SemicolonToken != default && position > declarationStatement.SemicolonToken.SpanStart)
        {
            position = variableDeclaration.SpanStart;
        }

        var variableDeclarator = FindClosestDeclaratorWithInitializer(variableDeclaration.Variables, position);
        if (variableDeclarator == null)
        {
            return default(TextSpan);
        }

        if (variableDeclarator == variableDeclaration.Variables[0])
        {
            // Include 'await' and 'using' keywords in the span if present
            return CreateSpan(
                startOpt: default,
                startFallbackOpt: declarationStatement.AwaitKeyword != default ? declarationStatement.AwaitKeyword :
                                  declarationStatement.UsingKeyword != default ? declarationStatement.UsingKeyword :
                                  declarationStatement.Modifiers.Count > 0 ? declarationStatement.Modifiers.First() :
                                  (SyntaxNodeOrToken)variableDeclaration,
                endOpt: variableDeclarator);
        }

        return CreateSpan(variableDeclarator);
    }

    private static TextSpan? TryCreateSpanForVariableDeclaration(VariableDeclarationSyntax declaration, int position)
        => declaration.Parent!.Kind() switch
        {
            // parent node will handle:
            SyntaxKind.LocalDeclarationStatement or SyntaxKind.EventFieldDeclaration or SyntaxKind.FieldDeclaration => null,

            _ => TryCreateSpanForVariableDeclaration(declaration, modifiersOpt: default, semicolonOpt: default, position),
        };

    private static TextSpan? TryCreateSpanForVariableDeclaration(
        VariableDeclarationSyntax variableDeclaration,
        SyntaxTokenList modifiersOpt,
        SyntaxToken semicolonOpt,
        int position)
    {
        if (variableDeclaration.Variables.Count == 0)
        {
            return null;
        }

        if (modifiersOpt.Any(SyntaxKind.ConstKeyword))
        {
            // no sequence points are emitted for const fields/locals

Review comment (suggestion):
@copilot all this seems very duplicative with TryCreateSpanForVariableDeclaration.  Instead of this method, either have TryCreateSpanForVariableDeclaration check the parent of the var-decl and adjust accordingly.  Or have the caller pass in some extra information (like the start of hte span to use).  

Code after:
        {
            if (variableDeclaration.Variables[0].Initializer == null)
            {
                return default(TextSpan);
            }

            // If we have a start node (e.g., LocalDeclarationStatementSyntax with 'using' or 'await'),
            // use it as the start to include those keywords in the span
            if (startNodeOpt != null)
            {
                return CreateSpan(
                    startOpt: default,
                    startFallbackOpt: startNodeOpt,
                    endOpt: semicolonOpt != default ? semicolonOpt : (SyntaxNodeOrToken)variableDeclaration);
            }

            return CreateSpan(modifiersOpt, variableDeclaration, semicolonOpt);
        }

        if (semicolonOpt != default && position > semicolonOpt.SpanStart)
        {
            position = variableDeclaration.SpanStart;
        }

        var variableDeclarator = FindClosestDeclaratorWithInitializer(variableDeclaration.Variables, position);
        if (variableDeclarator == null)
        {
            return default(TextSpan);
        }

        if (variableDeclarator == variableDeclaration.Variables[0])
        {
            // If we have a start node (e.g., LocalDeclarationStatementSyntax with 'using' or 'await'),
            // use it as the start to include those keywords in the span
            if (startNodeOpt != null)
            {
                return CreateSpan(
                    startOpt: default,
                    startFallbackOpt: startNodeOpt,
                    endOpt: variableDeclarator);
            }

            return CreateSpan(modifiersOpt, variableDeclaration, variableDeclarator);
        }

        return CreateSpan(variableDeclarator);
    }

    internal static TextSpan CreateSpanForVariableDeclarator(
        VariableDeclaratorSyntax variableDeclarator,
        SyntaxTokenList modifiers,