Bug 425473 - [typing] Surround multi-line text strings in formatter off/on tags when pasting
Summary: [typing] Surround multi-line text strings in formatter off/on tags when pasting
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.4   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-11 02:47 EST by Christian Pontesegger CLA
Modified: 2017-09-06 14:43 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Pontesegger CLA 2014-01-11 02:47:26 EST
I love the feature of pasting multiline text into a source file where I automatically get concatenated strings with line breaks on the correct positions:

        String data = "        \"first line\\r\\n\" + \r\n" + 
                "        \"another one\\r\\n\" + \r\n" + 
                "        \"and the final line\"";


Now after formatting the source file this nice structure is obviously gone depending on the line length parameter:

        String data = "        \"first line\\r\\n\" + \r\n" + "        \"another one\\r\\n\" + \r\n" + "        \"and the final line\"";

I know I may disable the formatter with 
// @formatter:off

But it would be a nice feature if these control statements would be automatically added when I paste multiline text. Eg made available through a checkbox in prefs/ editor/typing
Comment 1 Dani Megert CLA 2014-01-13 06:31:34 EST
You can disable joining already formatted lines (Code Style > Formatter > Edit > Line Wrapping tab). Does that solve your problem, or do you really want to "pollute" your code with the formatter directives?
Comment 2 Christian Pontesegger CLA 2014-01-14 09:20:48 EST
In my case I would prefer to go with the directives.

Enabling "Never join wrapped lines" seems to be odd eg if you simplify a long statement that got wrapped it will not be joined anymore to a single line.