Allow stripping of white space by the formatter to be an option.

For Resharper 4.0.1, can we have an option for spaces not to be stripped from a line by the formatter?

I like to allign operators and equal signs to make my code more readable, but whenever I kit ";" Resharper takes the extra tabs and spaces out. I would like stripping of white space to be an option.

4 comments
Comment actions Permalink

The only thing which is done by code formatter IS modification of spaces/new
lines between meaningfull symbols. So removing this functionality means
removing code formatter itself.

If you would like you can switch off auto-formatting on ";" in options

As for alignment of lines on equality sign - such style is very hard to
maintain, because, for example, renaming of a single symbol could lead to
re-formatting of the whole file

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Lorenzo Statie" <no_reply@jetbrains.com> wrote in message
news:9150160.131811216340098842.JavaMail.jive@app4.labs.intellij.net...

For Resharper 4.0.1, can we have an option for spaces not to be stripped
from a line by the formatter?

>

I like to allign operators and equal signs to make my code more readable,
but whenever I kit ";" Resharper takes the extra tabs and spaces out. I
would like stripping of white space to be an option.



0
Comment actions Permalink

Thank you for the reply. I will have to remember to use a trick I discovered. Entering a ; right after typing = causes resharper to not format the line at that point. That helps me keep my formatting.

0
Comment actions Permalink

I'm not sure if it's possible in the current configuration settings but is there a setting that will trim excess white space at the end of a line?

0
Comment actions Permalink

Two Things...

1.) It would be enough to simply change the Around Operators option to something like the following:

Before assignment operators (=, +=,...)    [No space, One space, Do not auto-format]

After assignment operators (=, +=,...)    [No space, One space, Do not auto-format]

     This would produce the following effects (I am using a '.' for space, so that it is obvious in HTML where there are multiple spaces):

Examples for Before assignment operators (=, +=,...)

Source:                   a....+=5;

                                                b..=.7;

No Space:                 a+=5;

                                                b=.7;

One space:                a.+=5;

                                                b.=.7;

Do not auto-format:           a....+=5;

                                                b..=.7;

Examples for After assignment operators (=, +=,...)

Source:                   a+=....5;

                                                b.=..7;

No Space:                 a+=5;

                                                b.=7;

One space:                a+=.5;

                                                b.=.7;

Do not auto-format:           a+=....5;

                                                b.=..7;

     Providing this support would allow other tools that can auto-format assignment to work.  For example, the Productivity Power Tools http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef

2.) Tools like the Productivity Power Tools require an active input from the user.  One must select the lines to format, and then hit a specific key combo.  What I really don't understand is why you would say, "for example, renaming of a single symbol could lead to re-formatting of the whole file".  Certainly I do not have files that are entirely made up of assignment statements.  Also, I would only expect assignments on contiguous lines to get lined up.  I think requiring a menu selection or accelerator key is a perfectly legitimate constraint.  If it was going to be automatic, then I would think having a limit on the number of lines to search up/down is also legitimate.

0

Please sign in to leave a comment.