Auto String Wrap

Automatically handles syntax for splitting long string values onto multiple lines in C# files.
When you press Enter inside a string literal, this extension automatically inserts:
- A closing quote
- A concatenation operator (
+ )
- A new line with one level of indentation deeper
- An opening
$" (if it was an interpolated string) or " otherwise
Features
- Automatic formatting of string literals in C#
- Preserves indentation by adding one extra tab relative to the original line
- Works with interpolated (
$" ) and standard (" ) strings
- No need for manual fiddling with quotes and
+ operators
Usage
- Open any
.cs file.
- Inside a string, place the cursor where you want a line break.
- Press Enter.
Example:
context.Logger.LogError($"Some extremely long log string that would be a lot cooler on two lines {nameof(ThisClass)}");
Press Enter before "lot" becomes
context.Logger.LogError($"Some extremely long log string that would be a " +
$"lot cooler on two lines {nameof(ThisClass)}");
| |