GenerateToString bug + enhancement
If you go to the demonstration template, it changes everything to gray.
If you go back to the normal template, everything is still grayed out.
Can you modify the default template to have carriage return characters?
IntelliJ formatting is unable to wrap the text.
--
Norris Shelton
Sun Certified Java Programmer
Please sign in to leave a comment.
Hi
Thanks for the bug report. I will look into it.
And for your enhancement, I will try to add it in an upcomming release.
/Claus
Thanks. Most appreciated!
Norris Shelton
Sun Certified Java Programmer
Claus Ibsen wrote:
>Hi
>
>Thanks for the bug report. I will look into it.
>
>And for your enhancement, I will try to add it in an upcomming release.
>
>/Claus
>
Found the bug and it is fixed.
This is only a bug if you do not already have a template activated from a previous installation of the plugin - afair as I can see.
Workaround is to activate one of the templates.
/Claus
Hi Norris
What excatly do you mean? Is it the generate toString() code you want to have \n chars in the string?
Example:
Before (as now):
What you want?
Or is it the settings editor that does not wrap the text? (Settings editor is where you can modify the velocity template that is based on generating the actual toString code)
The default tempalte do have carrige return characters. You can see the .vm file yourself in the .jar.
It is located in the folder:
org\intellij\idea\plugin\tostring\template
The default template is named: DefaultConcat.vm
/Claus
I was going to edit it, but I did not know how to make it skip to the
next line. Would that be a \n character? I was not sure if IntelliJ
would honor it in the editor window (might come out "\n").
I guess the better idea is to get the text wrapping fixed instead of
getting a workaround.
Norris Shelton
Sun Certified Java Programmer
no_mail@jetbrains.com wrote:
>Hi Norris
>
>
>>Can you modify the default template to have carriage
>>return characters?
>>IntelliJ formatting is unable to wrap the text.
>>
>>
>What excatly do you mean? Is it the generate toString() code you want to have \n chars in the string?
>
>Example:
>
>Before (as now):
>
return "DummyTestBean{" + > "tran='" + tran + "'" + > ", singleton=" + singleton + > ", myNewString='" + myNewString + "'" + > "}"; > }]]>>
>What you want?
>
return "DummyTestBean{" + > "\n tran='" + tran + "'" + > "\n singleton=" + singleton + > "\n myNewString='" + myNewString + "'" + > "}"; > }]]>>
>
>Or is it the settings editor that does not wrap the text? (Settings editor is where you can modify the velocity template that is based on generating the actual toString code)
>
>The default tempalte do have carrige return characters. You can see the .vm file yourself in the .jar.
>It is located in the folder:
>
>
>The default template is named: DefaultConcat.vm
>
>
>
>/Claus
>
>
Hi Norris
I still do not have a clue what you mean? Cann you spell it out for a stupid danish man :)
I will defintly look into your request when I understand what your problem is.
/Claus
I get the following result:
public String toString() {
return "Watch{" + "fullName='" + fullName + "'" + ",
released='" + released + "'" + ", DOB='" + DOB + "'" + ", state='" +
state + "'" + ", agency='" + agency + "'" + ", agencyID=" + agencyID +
", siteID=" + siteID + ", bookDate='" + bookDate + "'" + ", sex='" + sex
+ "'" + ", SSN='" + SSN + "'" + ", race='" + race + "'" + ", height='" +
height + "'" + ", weight='" + weight + "'" + ", eye='" + eye + "'" + ",
hair='" + hair + "'" + ", profile='" + profile + "'" + ", front='" +
front + "'" + ", bookingSID=" + bookingSID + ", incidentExists=" +
incidentExists
+ "}";
}
Stretch the window out far enough and you notice that all of it is on
the same line. Is there a way to make the output come out like:
public String toString() {
return "Watch{" + "fullName='" + fullName + "'" +
", released='" + released + "'" +
", DOB='" + DOB + "'" +
", state='" + state + "'" +
", agency='" + agency + "'" +
", agencyID=" + agencyID +
...
", incidentExists=" + incidentExists +
"}";
}
Norris Shelton
Sun Certified Java Programmer
no_mail@jetbrains.com wrote:
>>I was going to edit it, but I did not know how to
>>make it skip to the
>>next line. Would that be a \n character? I was not
>>sure if IntelliJ
>>would honor it in the editor window (might come out
>>"\n").
>>
>>I guess the better idea is to get the text wrapping
>>fixed instead of
>>getting a workaround.
>>
>>
>
>Hi Norris
>
>I still do not have a clue what you mean? Cann you spell it out for a stupid danish man :)
>
>I will defintly look into your request when I understand what your problem is.
>
>/Claus
>
Hi
After the code is generate it runs the IDEA code style formatter. Are you sure you are using the default IDEA code style?
And the template you are using is really the default concat? You have not changed it?
In the v2.13 BETA you can enable logging and it would output the generated code if I remember correctly.
What OS are you running? I am using WinXP. I could be a thingy with carriage returns are different on unix/windows.
In the next 5-7 days I do not have time to look into this as I have holiday and are out of town.
/Claus
I am using a custom style that is based on the default. Can you tell me
which setting to use? Even if I reformat manually, the auto-reformat
will throw them in a long line. Argh. I've had this problem since the
middle of the last EAP. Needless to say, it's not your plugin, just the
reformat.
Norris Shelton
Sun Certified Java Programmer
Claus Ibsen wrote:
>Hi
>
>After the code is generate it runs the IDEA code style formatter. Are you sure you are using the default IDEA code style?
>
>And the template you are using is really the default concat? You have not changed it?
>
>In the v2.13 BETA you can enable logging and it would output the generated code if I remember correctly.
>
>What OS are you running? I am using WinXP. I could be a thingy with carriage returns are different on unix/windows.
>
>In the next 5-7 days I do not have time to look into this as I have holiday and are out of town.
>
>/Claus
>
Hmm
I can not actually tell what the problem is.
If you manually breaks the line into several lines and do a IDEA reformat code it will honor your changes (keep as is)? or does it change it back into one line?
I have been away from computer now for 1-2 weeks, just back now. You could email me your custom template for me to try if I have the same problem.
BTW: Are you using a different OS than WinXP?
/Claus
I do not have the keep as set because this tends to keep some of the
garbage formatting I have inherited.
It would be great if the reformat options could clean this up. I am
hoping it is just a case of my config is not correct.
Norris Shelton
Sun Certified Java Programmer
Claus Ibsen wrote:
>Hmm
>
>I can not actually tell what the problem is.
>
>If you manually breaks the line into several lines and do a IDEA reformat code it will honor your changes (keep as is)? or does it change it back into one line?
>
>I have been away from computer now for 1-2 weeks, just back now. You could email me your custom template for me to try if I have the same problem.
>
>BTW: Are you using a different OS than WinXP?
>
>/Claus
>
Attachment(s):
Norris_Code_Style.xml