Home
Options

Code auto formatter is too aggressive with interpolated strings [LINQPad 5 Beta]

Are you taking feedback on the beta version? (Loving all the new features on top of C# 6 support BTW)

I was playing around with it a bit and noticed that LINQPad is messing up my interpolated strings. It's like it's trying to format the interpolated string as if it was code. It seems like it's adding spaces around all braces in all the places. It's even more aggressive when it's a regular interpolated string (as opposed to a verbatim interpolated string). Right clicking anywhere near them will have them reformatted.

So I might have strings like this:
$"{x.NonNullPoint.X} + {x.NonNullPoint.Y} = {x.NonNullPoint}"
$@"{{{x.NullPoint?.X}}} + {{{x.NullPoint?.Y}}} = ""{{{x.NullPoint}}}""
{x}"
get reformatted to this when the reformatter kicks in:
$"{ x.NonNullPoint.X }  +  { x.NonNullPoint.Y }  =  { x.NonNullPoint }";
$@" {{ { x.NullPoint?.X } }} + {{ { x.NullPoint?.Y } }} = ""{{ { x.NullPoint } }}""
 { x }";
If I have multiline text and add another expression within it, newlines will be inserted as well.

I think it should be tuned down quite a bit.

Comments

Sign In or Register to comment.