Repository navigation
Closed
Milestone
Description
Description
I found the result of formatting the following code unexpected.
- For the variable I would have liked the starting quotes to remain on a separate line and aligned the same wrt. the other lines of the raw string. But I can accept that this is a stylistic choice and that moving the starting quotes up is equally valid.
- For the lambda I would have expected the same behavior: Either move the starting quotes up one line OR keep the alignment of all four lines the same.
The good news is, that the value of the string itself remains the same across all these variants, so it is not a critical bug. It is more a question of whether it is an intentional stylistic choice or an accidental confluence of formatting rules.
Steps to Reproduce
Input:
using System;
using System.Linq;
public class Program
{
public static void Main()
{
var bar =
"""
a
b
""";
Func<int, string> foo = _ =>
"""
a
b
""";
Console.WriteLine(bar);
Console.WriteLine(foo(2));
}
}
Expected Behavior
using System;
using System.Linq;
public class Program
{
public static void Main()
{
var bar =
"""
a
b
""";
Func<int, string> foo = _ =>
"""
a
b
""";
Console.WriteLine(bar);
Console.WriteLine(foo(2));
}
}
OR
using System;
using System.Linq;
public class Program
{
public static void Main()
{
var bar = """
a
b
""";
Func<int, string> foo = _ => """
a
b
""";
Console.WriteLine(bar);
Console.WriteLine(foo(2));
}
}
Actual Behavior
Formatted with csharpier 1.4.0:
using System;
using System.Linq;
public class Program
{
public static void Main()
{
var bar = """
a
b
""";
Func<int, string> foo = _ =>
"""
a
b
""";
Console.WriteLine(bar);
Console.WriteLine(foo(2));
}
}
Metadata
Metadata
Assignees
Labels
No labels
Activity
Getting raw strings to format more consistently (belav#1942)
Bump csharpier from 1.4.0 to 1.4.1 (#519)
Bump the nuget-deps group with 2 updates (#610)
Bump the nuget-deps group with 3 updates (#611)
Bump the docs-tests-all group with 1 update (#828)
Bump the all-dependencies group with 1 update (#1340)
Bump csharpier from 1.3.0 to 1.4.1 (#148)
Bump csharpier from 1.4.0 to 1.4.1 (#273)