[llvm-bugs] [Bug 50515] New: [clang-format] successive C# attributes cause line breaking issues

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 28 02:06:05 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50515

            Bug ID: 50515
           Summary: [clang-format] successive C# attributes cause line
                    breaking issues
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mydeveloperday at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

The first attribute I format is formatted as expected with a newline after the
']'

using .clang-format

Language: CSharp                                                               
                                        BasedOnStyle:  Microsoft               
                                                                               
ColumnLimit: 120
---

But if a attribute follows it renders incorrectly not breaking the line

public class State
{
  [JsonProperty("age")]
  public int? Age { get; set; }

  [JsonProperty("gender")] public string gender { get; set; }
}

if I break with a class

public class State
{
  [JsonProperty("age")]
  public int? Age { get; set; }
}

public class State2
{
  [JsonProperty("gender")] 
  public string gender { get; set; }
}

its then correct

if I break with a comment, its not correct

public class ChannelState
{
    [JsonProperty("age")]
    public int? Age { get; set; }

    // test
    [JsonProperty("gender")] public string gender { get; set; 
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210528/b4bc7278/attachment.html>


More information about the llvm-bugs mailing list