Using statement formatting

Hello,

It is a common practice to align a group of using statements at the same
column and make no indentation:


Is there any option which controls the Re#er's behaviour for such cases?

Regards.



7 comments
Comment actions Permalink

Sorry, it my last post the lines containing "using" got wrapped -- that
wasn't intended.


0
Comment actions Permalink

Why do you prefer multiple usings in that case? There are no dependencies
between Dispose() and it seems to make sence to put them in one using to
save typing effort.

Is that practise really widely accepted?

--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"



"Maxim Babenko" <mab@shade.msu.ru> wrote in message
news:cb3lkc$hsj$1@is.intellij.net...

Hello,

>

It is a common practice to align a group of using statements at the same
column and make no indentation:

 using (textReader = new StreamReader(textFileName, Encoding.Unicode))
> using (logWriter = new StreamWriter(textFileName + ".log", false,
> Encoding.Unicode))
> using (unresolvedWriter = new StreamWriter(textFileName + ".unresolved",
> false, Encoding.Unicode))
> {
> ...
> }
> ]]>

>

Is there any option which controls the Re#er's behaviour for such cases?

>

Regards.

>
>


0
Comment actions Permalink

Hello, Andey.

You're right it this particular case -- but only for the reason I didn't
have those variables local. Most of time I use construction like


In such case you just can't replace a sequence of usings with a single one.
And indenting each of them makes the code unreadable.

Can't say exactly about acceptance of this style but built-in code formatter
of VS does not indent those statements. So I think I've got a feature
request -- to introduce an option for this. Would you mind if I will post it
to the Tracker?

Regards.



0
Comment actions Permalink

Yes, it would be nice if you post it as a feature request into the tracker.

--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"



"Maxim Babenko" <mab@shade.msu.ru> wrote in message
news:cb6oj4$676$1@is.intellij.net...

Hello, Andey.

>

You're right it this particular case -- but only for the reason I didn't
have those variables local. Most of time I use construction like

 using (T1 var1 = new T1())
> using (T2 var2 = new T2())
> ...
> ]]>

>

In such case you just can't replace a sequence of usings with a single

one.

And indenting each of them makes the code unreadable.

>

Can't say exactly about acceptance of this style but built-in code

formatter

of VS does not indent those statements. So I think I've got a feature
request -- to introduce an option for this. Would you mind if I will post

it

to the Tracker?

>

Regards.

>
>


0
Comment actions Permalink

Implemented in build 89

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Maxim Babenko" <mab@shade.msu.ru> wrote in message
news:cb6oj4$676$1@is.intellij.net...

Hello, Andey.

>

You're right it this particular case -- but only for the reason I didn't
have those variables local. Most of time I use construction like

 using (T1 var1 = new T1())
> using (T2 var2 = new T2())
> ...
> ]]>

>

In such case you just can't replace a sequence of usings with a single

one.

And indenting each of them makes the code unreadable.

>

Can't say exactly about acceptance of this style but built-in code

formatter

of VS does not indent those statements. So I think I've got a feature
request -- to introduce an option for this. Would you mind if I will post

it

to the Tracker?

>

Regards.

>
>


0
Comment actions Permalink

EP> Implemented in build 89
Well, I'm quite impressed. Do you have vacations, guys? =)


0
Comment actions Permalink

:)

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Maxim Babenko" <mab@shade.msu.ru> wrote in message
news:cb6q2s$kld$1@is.intellij.net...

EP> Implemented in build 89
Well, I'm quite impressed. Do you have vacations, guys? =)

>
>


0

Please sign in to leave a comment.