VS2010 / R#5.1
I have this "line" of code:
With.Mocks(_mocks).Expecting(() => {
_fooServiceMock.Expect(x => x.FooMethod()).Return(fooMockData);
}).Verify(() => {
});
I perform a R# code cleanup, which changes the code as follows:
With.Mocks(_mocks).Expecting(() => { _fooServiceMock.Expect(x => x.FooMethod()).Return(fooMockData); }).Verify(() => { });
开发者_如何转开发That is, it reformats the statement such that it appears entirely on one line.
What IDE/R# setting is responsible for this? What can I change to preserve my line breaks when I perform a R# code cleanup?
I would have thought 'R# / Options / Languages / C# / Formatting Style / Line Breaks and Wrapping / Preserve Existing Formatting / Keep existing line breaks', but that doesn't seem to make any difference.
It's Place simple anonymous method on single line
option in Line Breaks and Wrapping
category.
Go to Tools --> Options then scroll to the bottom and under Tools (different than the first) go to Code Cleanup. If you do not have a profile to edit then just create one and select your settings. I think for what you are looking to do you want to have reformat code unchecked.
Now the next time you run Code Cleanup it won't move it to one line.
For more help check out http://www.jetbrains.com/resharper/webhelp/Code_Cleanup__Creating_Custom_Profiles.html
Edit: Noticed this
Reformat code
Reformats you code according to options configurable in ReSharper | Options | Languages | C# | Formatting Style for C# code.
精彩评论