Insert blank line in code templates?

Questions and answers regarding the use of eclipse environment as seen in Servoy Developer

Insert blank line in code templates?

Postby gdotzlaw » Sat Aug 01, 2009 4:13 pm

This should be easy, but...

How does one insert blank lines in a code template?

For example, the if/else template looks like this:
Code: Select all
if (${condition}) {
   ${cursor}
} else {
   
}

and I edited the template and want the final result to look like this:
Code: Select all
if (${condition})
{
   ${cursor}
}
else
{
   
}

but no matter what I try, it stays like the original. In fact, any code template I write, all my blank lines are ignored.

I'm beginning to think that the code templates are auto-formatted by the formatter when they are inserted, and since the formatter insists on keeping the "{" with the line and remove all blank lines (relates to my post on how you configure the javascript formatter), the template is ignored.

What am I doing wrong? Somebody bring me more coffee...
Gary
---------------------------------------------
Dotzlaw Consulting
User avatar
gdotzlaw
 
Posts: 106
Joined: Fri Jul 13, 2007 11:17 pm
Location: Winnipeg, MB, Canada

Re: Insert blank line in code templates?

Postby pbakker » Mon Aug 03, 2009 10:05 am

Yes, the auto format is applied, which makes the extra line disappear.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: Insert blank line in code templates?

Postby kazar » Mon Aug 03, 2009 4:17 pm

is there a way to comment out and then uncomment (i.e., disable & then enable) blocks of code? That would be useful. Perhaps it's here in Eclipse somewhere, there are so many different features and cool things. Could you please remove some of these features? <grin>

seriously, it would be nice if we could type a template such as Gary's trying to do, select all the lines and click a Disable button (yes, ok, fine, like FMP) that would result in:

//if (${condition})
//{
// ${cursor}
//}
//else
//{
//
//}

then after recalling the template, click an Enable button to remove the //s

if this is not there already, and is not a silly idea for some reason that exceeds my level of experience, I would be happy to file a feature request
User avatar
kazar
 
Posts: 367
Joined: Sat Sep 13, 2003 9:59 pm
Location: New York City

Re: Insert blank line in code templates?

Postby pbakker » Mon Aug 03, 2009 4:23 pm

try Control-/ and Control-Shift-/

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: Insert blank line in code templates?

Postby gdotzlaw » Mon Aug 03, 2009 5:16 pm

Thanks for the tip. I will comment my templates, and uncomment them once inserted. Once control over the javascript code formatter is implemented, we can drop the use of comments in our templates and use this feature as originally intended.
User avatar
gdotzlaw
 
Posts: 106
Joined: Fri Jul 13, 2007 11:17 pm
Location: Winnipeg, MB, Canada

Re: Insert blank line in code templates?

Postby kazar » Mon Aug 03, 2009 6:14 pm

pbakker wrote:try Control-/ and Control-Shift-/

:o

thanks!
User avatar
kazar
 
Posts: 367
Joined: Sat Sep 13, 2003 9:59 pm
Location: New York City


Return to Eclipse Environment

Who is online

Users browsing this forum: No registered users and 1 guest