ReSharper 2021.1 Help

Split Lines containing String Literals

When you type long string literals, ReSharper helps you split the lines and add the necessary quotation marks and plus signs.

While the caret is within a string literal,

ReSharper: Splitting string literals
pressing Enter will split the string correctly so that your code syntax does not get broken:
ReSharper: Splitting string literals

Now, if you delete the + sign, the string parts will be back together without redundant quotes.

Another way of splitting a string literal is to set the caret where you want to split the string, press Alt+Enter and choose Split string. This context action will also add necessary quotation marks and +, but both parts of the string will stay on the same line.

This feature is supported in the following languages and technologies:

Language: C#Language: VB.NETLanguage: C++Language: HTMLLanguage: ASP.NETLanguage: RazorLanguage: JavaScriptLanguage: TypeScriptLanguage: CSSLanguage: XMLLanguage: XAMLLanguage: ResxLanguage: Build ScriptsLanguage: ProtobufLanguage: JSON
Feature is available in C# Feature is not available in Visual Basic .NET Feature is not available in C++ Feature is not available in HTML Feature is not available in ASP.NET Feature is not available in RazorFeature is available in JavaScriptFeature is available in TypeScript Feature is not available in CSS Feature is not available in XML Feature is not available in XAML Feature is not available in Resource files Feature is not available in build script files Feature is not available in Protobuf Feature is not available in JSON

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.

Last modified: 08 March 2021