Menu

#602 Second case of semicolon alignment problem from multiline C# literals

0.61
fixed
C#
5
2014-10-07
2014-09-12
Scott Bilas
No

I found a new case for the issue that was fixed in http://sourceforge.net/p/uncrustify/bugs/599/:

public class C
{
    public void F()
    {
        var x =
@"
";
    }
}

Running uncrustify on this with the default config yields:

public class C
{
public void F()
{
        var x =
                @"
"                    ;
}
}

Semicolon is getting spaced way out, but should stick to the closing quote.

Discussion

  • Scott Bilas

    Scott Bilas - 2014-09-12

    Another variation that involves string concatenation also causes the ; padding problem:

    class C
    {
        void F()
        {
            var x = "" +
    @"
    ";
        }
    }
    

    this results in:

    class C
    {
    void F()
    {
        var x = "" +
                @"
    "                    ;
    }
    }
    

    Note that, for this case, if the '+' character is moved to the same line as the @", the problem does not reproduce.

     

    Last edit: Scott Bilas 2014-09-12
  • Ben Gardner

    Ben Gardner - 2014-10-07
    • labels: --> multiline, space
    • status: open --> fixed
    • assigned_to: Ben Gardner
    • Group: Future --> 0.61
     
  • Ben Gardner

    Ben Gardner - 2014-10-07

    Should be fixed. There may be other instances - anywhere space_col_align() is called has a potential issue.

     
  • Scott Bilas

    Scott Bilas - 2014-10-07

    Thanks for the fix, looks good on my end.