Reformat Code
When I use "reformat code" on a long line like (VB code):
Dim myNewObject as New Object(..........................)
It can turn it into:
Dim _
myNewObject as New Object(..........................)
which basically is just wasting space as far as I can see. Is there a way to turn off this splitting of the Dim with the object initialization?
Please sign in to leave a comment.
Sorry, that did not format correctly. The resulting code after the "reformat code" is
Dim _
......myNewObject as New Object(.......................)
where the initial '.' characters are spaces.
Hello mike,
Configure your preferences at Options / Languages / Visual Basic .NET / Formatting
Style / Line Breaks and Wrapping
Sincerely,
Ilya Ryzhenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
mg> Sorry, that did not format correctly. The resulting code after the
mg> "reformat code" is
mg>
mg> Dim _
mg> .....myNewObject as New Object(.......................)
mg> where the initial '.' characters are spaces.
mg>
I could not find a setting there that will keep the line from breaking directly after the 'Dim' statement. Which option is it?
Hello mike,
In the first place, do you want the long line to be split into shorter lines?
If so, how would you like it to be split? Could you give us few examples?
Sincerely,
Ilya Ryzhenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
mg> I could not find a setting there that will keep the line from
mg> breaking directly after the 'Dim' statement. Which option is it?
mg>
It is fine that the line is split if it is too long in general, but I don't understand why the 'Dim' is being separated from the variable name when the result saves no space...example:
Dim propertyValue As Object = CODA.SupportClasses.ReflectionUtilities.GetProperty(Me, propertyName, Nothing)
becomes:
Dim _
.......propertyValue As Object = _
.............CODA.SupportClasses.ReflectionUtilities.GetProperty(Me, propertyName, Nothing)
I, for one, NEVER want a line split at an equal sign. I hate that, and
always have to undo it when Resharper does that. I wish I could turn that
off.
I use C# exclusively though. Is there a setting to turn that off? If not,
can there be one in the next version? I never understood why anyone would
want to break a statement at an equal sign like that. Better to break at a
space or comma in a parameter list, or something like that, for long
function calls, or at some other operator in a long expression.
"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:c8a8a1be13feb28c99925396ce5e8@news.intellij.net...
>
>
>
>
>
Paul Bradshaw wrote:
+1 for that, for expressions like this:
Dim propertyValue As Object =
CODA.SupportClasses.ReflectionUtilities.GetProperty(Me, propertyName,
Nothing)
i would like that r# break after some "word" near column position
value(can be taken from R# options->C#->Formatting style->Line breaks
and wrapping->Line wrapping->Right margin(columns))
Lets say this value(right margin(columns)) is set to 120 (default) and
for expression:
Dim propertyValue As Object =
CODA.SupportClasses.ReflectionUtilities.GetProperty(Me, propertyName,
Nothing)
expression "....Me, |....", where | is positioned at column 120,
nearest word to left is Me, and thus r# breaks after this word, and it
can looks like:
Dim propertyValue As Object =
CODA.SupportClasses.ReflectionUtilities.GetProperty(Me,
.....propertyName, Nothing)
Is that possible?
--
Peter Sulek
terrorix@centrum.sk
XanaNews ver. 1.18.1.6
I'd just like to reiterate my original request...that there be a way to make the reformat code not split a 'Dim' from the rest of the line if it will not save any column space by doing so.
This has not been addressed yet. Is there any plan to fix this? After two years, I still cannot use "Reformat Code" in my VB.NET projects because of what it does to a 'Dim' statement.
Hello Mike
I've created a feature request in our tracker: http://www.jetbrains.net/jira/browse/RSRP-122231 and you're welcome to monitor its status.
Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"Thanks, Andrey.
Personally I would like to see this as a bug instead of a feature request (as this looks like an unintended flaw in Format Code), but ultimately its up to you
Yeah, it is definitely a bug. It breaks an existing feature.