Getting so close, and I'm so excited! There are still several bugs and missing features, but it's close enough that I'm willing to deal with it right now and stop using Recrasher's formatter.
When I format my document using my object initializer format settings, the first time I format the document it functions correctly:
C#var request = new Request()
{
Id = info.MyId,
RateId = voucherInfo.RateId,
};
The next time I run the document format, it reformats this section so that it ends up not following the original rules, namely removing the initial indentation:
C#var request = new Request()
{
Id = info.MyId,
RateId = voucherInfo.RateId,
};
This happens whether I have wrapping by Declaration or by Declaration Name.
A missing thing I haven't been able to figure out how to handle is nesting of indentation rules. I can't find an option to specify that I want indentation by declaration based with respect to nesting level. So if I have a method call that has a nested object initializer, for instance, indentation for the nested items all end up being reset to the original declaration's level when indenting by declaration (as does nested Call Chaining).
Indenting by declaration name is typically too deep of an indentation in the case of nesting (but at least right now it's closer to what I want more often than not, so I'll see if I can get used to it).
I could get used to splitting things out more, but I would certainly love to see the Smart Copy / Paste automatically introduce a local variable for me as in CodeRush Classic -- otherwise splitting things out interrupts my flow too much.
Hello Jason,
Thank you for contacting us and providing the code sample.
I tried to reproduce the issue with formatting an object initializer, but without success.
To help us research this issue, please provide additional information:
- CodeRush settings (they can be obtained here: %AppData%\CodeRush\Settings.xml);
- CodeRush log files (they can be obtained here: %LocalAppData%\CodeRush\Log);
- a screencast that illustrates the issue in action (you can capture it using a free Jing tool from TechSmith).
Regarding the questions about indentation and the Smart Copy / Paste feature, I have created separate tickets: Formatting - Indentation taking into account nested levels and Smart Copy / Paste should automatically introduce a local variable like in CodeRush Classic, which will be answered shortly.
We are looking forward to your response.
I don't recall how to turn on the heavy logging for CodeRush, but I've attached the latest log after closing VS, restarting it, making the problem happen, then closing it again.
I took a screencast of the formatting working properly on pass one, then formatting again right after, which breaks it.
I have attached both the exported settings and a manual zip of my settings.
Hello Jason,
Thank you for collecting and providing additional information.
I managed to reproduce the issue with your settings.
So we will research it and let you know as soon as we have any results.