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

            Bug ID: 44454
           Summary: [clang-format] support interpolated and verbatim
                    strings for CSharp formatting
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: brut...@google.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Interpolated (e.g. $"{expression} literal" ) and verbatim (e.g. @" ""foo"" " )
strings should not be modified in a program/compile breaking fashion.  Below
are a few examples of symptoms.

clang-format.exe version 10.0.0 downloaded from here:

https://www.google.com/url?q=https://prereleases.llvm.org/win-snapshots/clang-format-e20a1e486e1.exe&sa=D&ust=1578080154426000&usg=AFQjCNFOoOqZ8Iurk2gAxe8hICMLOJapgg

----------.clang-format----------
Language: CSharp
BasedOnStyle: Microsoft

ColumnLimit: 100
AlignAfterOpenBracket: DontAlign
AllowShortFunctionsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
IndentCaseLabels: true

BreakStringLiterals: false
---------------------------------



----------Code 1 Before----------
class Foo
{
    string str = @"""";
}
---------------------------------

----------Code 1 After-----------
class Foo
{
    string str = @"" "";
                   ^^^ Extra space added
}
---------------------------------



----------Code 2 Before----------
class Foo
{
    string str1 = $"{null ?? "null"}";
    string str2 = $"{string.Join(";", lines)}";
}
---------------------------------

----------Code 2 After----------
class Foo
{
    string str1 = $"{null ?? " null "}";
                             ^^^  ^^^ Extra spaces added
    string str2 = $"{string.Join(";
                                  ^^^ Newline added, this doesn't even compile.
    ", lines)}";
}
---------------------------------

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to