History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RSRP-33135
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Eugene Pasynkov
Reporter: Valentin Kipiatkov
Votes: 2
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
ReSharper

Indentation of many-line statements

Created: 07 Dec 06 21:27   Updated: 14 Dec 07 17:24
Component/s: Code Cleanup
Fix Version/s: 3.1.1
Security Level: Everybody (All jira users)

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Old URL: news://news.intellij.net/9564265.1163790154522.JavaMail.itn@is.intellij.net


 Description  « Hide
This issue has been created from an NNTP article.

Since there is no <pre> support, assume ">" indicates one level of indentation.

I would like long string statements to be aligned this way:
string s =
>"long part 1\n" +
>"long part 2";

Unfortunately, it would appear that the only relevant setting in ReSharper Options is found under C# | Other | Indentation | Continuous line indent multiplier; setting this value to "1" yields:
string s =
>"long part 1\n" +
>>"long part 2";

Setting this value to "0" yields:
string s =
"long part 1\n" +
"long part 2";

Neither is correct. Am I missing something, or is the formatting I desire not possible?



 All   Comments   Work Log   Change History      Sort Order:
Mike Strobel - 06 Oct 07 20:41
I agree, indentation is one feature in ReSharper that needs to be much more configurable. For instance, I like to indent my compound boolean statements by parameterized groups like this:

if (((_gaussianHistory[_gaussianHistory.Length - 1] < 0.0)
>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 2] < 0.0)
>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 3] < 0.0)
>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 4] < 0.0))
>>>>|| ((_gaussianHistory[_gaussianHistory.Length - 1] > 0.0)
>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 2] > 0.0)
>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 3] > 0.0)
>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 4] > 0.0)))

However, if I reformat my document, ReSharper will invariably reformat the above code like so:

if (((_gaussianHistory[_gaussianHistory.Length - 1] < 0.0)
>>>>&& (_gaussianHistory[_gaussianHistory.Length - 2] < 0.0)
>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 3] < 0.0)
>>>>>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 4] < 0.0))

((_gaussianHistory[_gaussianHistory.Length - 1] > 0.0)
>>>>&& (_gaussianHistory[_gaussianHistory.Length - 2] > 0.0)
>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 3] > 0.0)
>>>>>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 4] > 0.0)))

This is a real annoyance. The only other option is to set the 'Continue indent multiplier' to '0', but that's not acceptable either (and it also screws up other types of multiline statements).

Please, please, please add more flexible support for indentation. Given that indentation is one of the more fundamental (and personal) aspects of code style, I'm really quite surprised at ReSharper's current inflexibility in this area. The rest of ReSharper's code formatting options are quite stellar.


Mike Strobel - 06 Oct 07 20:45
Correction to my previous comment – the second block of code (the code after being reformatted by ReSharper) appears like so:

if (((_gaussianHistory[_gaussianHistory.Length - 1] < 0.0)
>>>>&& (_gaussianHistory[_gaussianHistory.Length - 2] < 0.0)
>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 3] < 0.0)
>>>>>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 4] < 0.0))
>>>>>>>>>>>>>>>>|| ((_gaussianHistory[_gaussianHistory.Length - 1] > 0.0)
>>>>>>>>>>>>>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 2] > 0.0)
>>>>>>>>>>>>>>>>>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 3] > 0.0)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>&& (_gaussianHistory[_gaussianHistory.Length - 4] > 0.0)))


Peter B - 18 Oct 07 13:10
I agree, and I think this is a bug and not a new feature.

This is the number one bug that our developers would like to be solved as soon as possible.

I also believe this is the same problem as described in RSRP-27892:
"The code format option "Continuous line indent multiplier" keeps adding additional indentation to each subsequent line."