How to configure multi-line statements the way I'd like?
I would like to have my statement formatted like so (spaces replaced with underscores for emphasis):
return FindBestAMatch(item)
____?? FindBestBMatch(item)
____?? FindBestCMatch(item)
____?? FindBestDMatch(item);
Note the alignment of the coalesce operator at the same indentation level, 1 level indented. But R# wants to format it as such:
return FindBestAMatch(item)
____?? FindBestBMatch(item)
________?? FindBestCMatch(item)
____________?? FindBestDMatch(item);
Note the progressive indenting for each line. Strangely, multi-line statements from method chaining has the indenting I want:
public TestDataSet a001_BasicAMatch = new TestDataSet()
____.AddItemPrice(101, 201, "BX", 10, 50)
____.AddProviderItem(301, 201, "BX", "10", "A", "BX", 10, 101)
____.AddPurchaseFact(401, 301, 100);
This is with the R# option for "Languages > C# > Formatting Style > Other > Indentation > Continuous line indent multiplier" set to 1. If I set it to 0, I get this:
return FindBestAMatch(item)
?? FindBestBMatch(item)
?? FindBestCMatch(item)
?? FindBestDMatch(item);
Notice the lack of any indentation. This is also not what I want. Is there a way with the current R# options to get the type of indenting I want?
Please sign in to leave a comment.
+1
It should apply to all operators too, of course (+, -, ||, &&, etc..).
"Jim Bolla" <no_reply@jetbrains.com> wrote in message
news:24962333.1192633864556.JavaMail.itn@is.intellij.net...
>I would like to have my statement formatted like so (spaces replaced with
>underscores for emphasis):
>
>
>
>
>
>
>
>
Have you checked the "Align multiline expression" option in the
C#->Formatting Style->Other page?
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Jim Bolla" <no_reply@jetbrains.com> wrote in message
news:24962333.1192633864556.JavaMail.itn@is.intellij.net...
>I would like to have my statement formatted like so (spaces replaced with
>underscores for emphasis):
>
>
>
>
>
>
>
>
Thanks. Expression, under Align Multiline Constructs, was what I was looking
for.
"Eugene Pasynkov (JetBrains)" <Eugene.Pasynkov@jetbrains.com> wrote in
message news:ff9llb$vlc$1@is.intellij.net...
>
>>I would like to have my statement formatted like so (spaces replaced with
>>underscores for emphasis):
>>
>> return FindBestAMatch(item)
>> ____?? FindBestBMatch(item)
>> ____?? FindBestCMatch(item)
>> ____?? FindBestDMatch(item);
>>
>> Note the alignment of the coalesce operator at the same indentation
>> level, 1 level indented. But R# wants to format it as such:
>>
>> return FindBestAMatch(item)
>> ____?? FindBestBMatch(item)
>> ________?? FindBestCMatch(item)
>> ____________?? FindBestDMatch(item);
>>
>> Note the progressive indenting for each line. Strangely, multi-line
>> statements from method chaining has the indenting I want:
>>
>> public TestDataSet a001_BasicAMatch = new TestDataSet()
>> ____.AddItemPrice(101, 201, "BX", 10, 50)
>> ____.AddProviderItem(301, 201, "BX", "10", "A", "BX", 10, 101)
>> ____.AddPurchaseFact(401, 301, 100);
>>
>> This is with the R# option for "Languages > C# > Formatting Style > Other
>> > Indentation > Continuous line indent multiplier" set to 1. If I set it
>> to 0, I get this:
>>
>> return FindBestAMatch(item)
>> ?? FindBestBMatch(item)
>> ?? FindBestCMatch(item)
>> ?? FindBestDMatch(item);
>>
>> Notice the lack of any indentation. This is also not what I want. Is
>> there a way with the current R# options to get the type of indenting I
>> want?
>
Hi,
I have tried various combinations of Indentation > Continuous line indent multiplier and Align Multiline Constucts >Expression (both in C# > Formatting Style > Other), but behavior is still weird:
.Factory
.Scheduler
.Id;
.Factory
.Scheduler
.Id;
.Factory
.Scheduler
.Id;
<tab>.Factory
<tab>.Scheduler
<tab>.Id;
<tab>.Factory
<tab>.Scheduler
<tab>.Id;
while(bytesToWrite > 0
&& WaitHandle.WaitAny(waitHandles) == 0
&& !cancellationEvent.WaitOne(0))
while(bytesToWrite > 0
&& WaitHandle.WaitAny(waitHandles) == 0
&& !cancellationEvent.WaitOne(0))
while(bytesToWrite > 0
_____&& WaitHandle.WaitAny(waitHandles) == 0
_____&& !cancellationEvent.WaitOne(0))
while(bytesToWrite > 0
<tab>&& WaitHandle.WaitAny(waitHandles) == 0
<tab><tab>&& !cancellationEvent.WaitOne(0))
while(bytesToWrite > 0
_____&& WaitHandle.WaitAny(waitHandles) == 0
_____&& !cancellationEvent.WaitOne(0))
(underline _ above is for space; second/third lines of where are space-aligned under bytesToWrite)
instead of wanted
int i = Task
<tab>.Factory
<tab>.Scheduler
<tab>.Id;
and
while(bytesToWrite > 0
<tab>&& WaitHandle.WaitAny(waitHandles) == 0
<tab>&& !cancellationEvent.WaitOne(0))
Am I doing something wrong? Thank you for ideas.
Roman
Hi,
Any chance of getting any answer? (positive or negative - any) I cannot believe that no-one from JetBrains cannot answer such a simple quesion. :(
Roman