Consider the snippet below:
C#// calculate price of a component based on the calculation units; length, surface or item
switch (prp.CalculationUnit)
{
/*
* Block comments don't suffer
*/
case ComponentCalculationUnit.lenght: // single line comment that gets thrown around
sizingFactor = component.OutlineSize.Width
* 0.001;
break;
// another single line comment that gets mangled
case ComponentCalculationUnit.surface:
sizingFactor = component.OutlineSize.Width
* component.OutlineSize.Height
* 0.000001;
break;
}
After applying formatting rules to this code it looks like this:
C# // calculate price of a component based on the calculation units; length, surface or item
switch (prp.CalculationUnit)
{
/*
* Block comments don't suffer
*/
case ComponentCalculationUnit.lenght:
// single line comment that gets thrown around
// single line comment that gets thrown around
sizingFactor = component.OutlineSize.Width
* 0.001;
break;
// another single line comment that doesn't get mangled
case ComponentCalculationUnit.surface:
sizingFactor = component.OutlineSize.Width
* component.OutlineSize.Height
* 0.000001;
break;
}
The single line comment should actually stay in place, but instead three unintended things happen
- The comment gets repositioned below the line of code it's meant to clarify
- The comment gets duplicated
- Indentation is lost.
Note: Please find my current coderush settings attached to ease reproduction attempts.
Note: I manually fixed another issue in the second snippet for which I filed a different ticket HERE
Thank you for the settings. I reproduced these issues. We will notify you here when we fix them. Please bear with us.