views:

75

answers:

0

Possible Duplicate:
Is there a way to keep ReSharper from formatting a region of code

When I want to test parsing logic on data that would usually be read in from a file or an HTTP call, etc, I usually turn that data into a string in the test. A (short) example is as follows:

Line 1
    Line 2
Line3
  Line 4

Would become:

const string log = "Line 1\n" +
                   "    Line 2\n" +
                   "Line3\n" +
                   "  Line 4\n" +
                   "\n";

I would like to prevent Resharper from reformatting these as:

const string log = "Line 1\n" + "    Line 2\n" +
                   "Line3\n" + "  Line 4\n" + "\n";

to keep them fairly readable.

Is there a way to disable reformatting of a specific section of code in Resharper 5? Creating a custom generated code region does not seem to work (I believe it only applies to code suggestions and such -- not reformatting).

Alternately, if there was a way to chop binary operators if long, that would do it as well (I wouldn't mind if it were universal), but I don't see such an option.

One alternate option is to turn preserve existing line breaks on, but I generally want to keep it off so that weird line breaks in other places will be removed.

related questions