Skip to content

Settings and activity

1 result found

  1. 2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    An error occurred while saving the comment
    Alain d'Espaignet commented  · 

    I don't know what it is that you use under the hood to to structure compare but I can tell it is wrong!
    Here I found this program that uses Rosyln to do code syntax tree compare...
    https://github.com/AlexGhiondea/CodeDiff
    I modified it file TextCodeDiff.cs line 111 to skip the string literal tokens

    foreach (var added in _codeDiff.GetModified())
    {
    // Ignore string literal differences as in attributes
    // https://github.com/AlexGhiondea/CodeDiff
    if (!added.Before.IsKind(Microsoft.CodeAnalysis.CSharp.SyntaxKind.StringLiteralToken) &&
    !added.After.IsKind(Microsoft.CodeAnalysis.CSharp.SyntaxKind.StringLiteralToken))
    {
    ColorSection(rtbAfter, added.After.Span.Start, added.After.Span.Length, Color.LightGreen);
    ColorSection(rtbBefore, added.Before.Span.Start, added.Before.Span.Length, Color.LightSalmon);
    }
    }
    This yields the right result.
    Your product is wrong string literal differences do not constitute code structure differences.
    Sorry I can't attach a picture here to show you.

    Alain d'Espaignet shared this idea  ·