[llvm-bugs] [Bug 44454] New: [clang-format] support interpolated and verbatim strings for CSharp formatting

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 3 12:46:04 PST 2020


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: unassignedclangbugs at nondot.org
          Reporter: bruthig at google.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200103/7cd8f5d9/attachment.html>


More information about the llvm-bugs mailing list