Code templates for IDEA

Dear all,has someone created or knows how to create live templates for most common scala collection methods, such as foreach, map, collect, and so on?
Best Regards
Edmondo

Re: Code templates for IDEA

Am 28.12.2011 16:22, schrieb Edmondo Porcu:
> Dear all,
> has someone created or knows how to create live templates for most
> common scala collection methods, such as foreach, map, collect, and so on?
>
> Best Regards
>
> Edmondo
what exactly is the boilerplate you are trying to template away?
anyway, you can take a look at the existing templates for for loops

Re: Code templates for IDEA

On 2011, Dec 28, at 7:26 PM, HamsterofDeath wrote:
>> has someone created or knows how to create live templates for most
>> common scala collection methods, such as foreach, map, collect, and so on?
> what exactly is the boilerplate you are trying to template away?
> anyway, you can take a look at the existing templates for for loops

I don't know if cmd/ctrl-p (for show parameters) will help, but I find that helps a lot, personally.

yours
Geir

Re: Code templates for IDEA

I did it but and I created a template for foreach,
but it doesn't work as expected because:
- It doesn't guess or propose the transversable name- It doesn't propose the name of the temporary variable to store the current element
bEst Regards

2011/12/29 Geir Hedemark <geir [dot] hedemark [at] gmail [dot] com>
On 2011, Dec 28, at 7:26 PM, HamsterofDeath wrote:
>> has someone created or knows how to create live templates for most
>> common scala collection methods, such as foreach, map, collect, and so on?
> what exactly is the boilerplate you are trying to template away?
> anyway, you can take a look at the existing templates for for loops

I don't know if cmd/ctrl-p (for show parameters) will help, but I find that helps a lot, personally.

yours
Geir


Re: Code templates for IDEA

Am 29.12.2011 09:22, schrieb Edmondo Porcu:
zBHkFfWsxrL0_saiBVG2uTQ [at] mail [dot] gmail [dot] com" type="cite">I did it but and I created a template for foreach,
but it doesn't work as expected because:
- It doesn't guess or propose the transversable name - It doesn't propose the name of the temporary variable to store the current element
bEst Regards

2011/12/29 Geir Hedemark <geir [dot] hedemark [at] gmail [dot] com" rel="nofollow">geir [dot] hedemark [at] gmail [dot] com>
On 2011, Dec 28, at 7:26 PM, HamsterofDeath wrote:
>> has someone created or knows how to create live templates for most
>> common scala collection methods, such as foreach, map, collect, and so on?
> what exactly is the boilerplate you are trying to template away?
> anyway, you can take a look at the existing templates for for loops

I don't know if cmd/ctrl-p (for show parameters) will help, but I find that helps a lot, personally.

yours
Geir


open original working template
press "edit variables" and take a look at the important parts you are probably missing



Re: Code templates for IDEA

Dear All,
I actually discovered there are some Expressions for scala which you don't find in the list. I have found them investigating existing scala template.

Namely they are

scalaVariableOfType

suggestScalaVariableName

Do you have an idea of where one can find more details?

Best Regards

2011/12/29 HamsterofDeath <h-star [at] gmx [dot] de>
Am 29.12.2011 09:22, schrieb Edmondo Porcu:
I did it but and I created a template for foreach,
but it doesn't work as expected because:
- It doesn't guess or propose the transversable name - It doesn't propose the name of the temporary variable to store the current element
bEst Regards

2011/12/29 Geir Hedemark <geir [dot] hedemark [at] gmail [dot] com>
On 2011, Dec 28, at 7:26 PM, HamsterofDeath wrote:
>> has someone created or knows how to create live templates for most
>> common scala collection methods, such as foreach, map, collect, and so on?
> what exactly is the boilerplate you are trying to template away?
> anyway, you can take a look at the existing templates for for loops

I don't know if cmd/ctrl-p (for show parameters) will help, but I find that helps a lot, personally.

yours
Geir


open original working template
press "edit variables" and take a look at the important parts you are probably missing




Re: Code templates for IDEA

-------- Original-Nachricht --------
> Datum: Wed, 11 Jan 2012 12:10:28 +0100
> Von: Edmondo Porcu
> An: scala-user
> Betreff: Re: [scala-user] Code templates for IDEA

> Dear All,
> I actually discovered there are some Expressions for scala which you don't
> find in the list. I have found them investigating existing scala template.
>
> Namely they are
>
> scalaVariableOfType
>
> suggestScalaVariableName
>
> Do you have an idea of where one can find more details?
>
> Best Regards
>
> 2011/12/29 HamsterofDeath
>
> > Am 29.12.2011 09:22, schrieb Edmondo Porcu:
> >
> > I did it but and I created a template for foreach,
> >
> > but it doesn't work as expected because:
> >
> > - It doesn't guess or propose the transversable name
> > - It doesn't propose the name of the temporary variable to store the
> > current element
> >
> > bEst Regards
> >
> > 2011/12/29 Geir Hedemark
> >
> >> On 2011, Dec 28, at 7:26 PM, HamsterofDeath wrote:
> >> >> has someone created or knows how to create live templates for most
> >> >> common scala collection methods, such as foreach, map, collect, and
> so
> >> on?
> >> > what exactly is the boilerplate you are trying to template away?
> >> > anyway, you can take a look at the existing templates for for loops
> >>
> >> I don't know if cmd/ctrl-p (for show parameters) will help, but I find
> >> that helps a lot, personally.
> >>
> >> yours
> >> Geir
> >>
> >>
> > open original working template
> > press "edit variables" and take a look at the important parts you are
> > probably missing
> >
> >
> >
> >

Re: Code templates for IDEA

The existing templates are of the form:

for (a <- bob) { doStuff(a) }

I think the OP is looking for stuff more like:

bob.foreach((a) => doStuff(a))

On Wed, Dec 28, 2011 at 1:26 PM, HamsterofDeath wrote:
> Am 28.12.2011 16:22, schrieb Edmondo Porcu:
>> Dear all,
>> has someone created or knows how to create live templates for most
>> common scala collection methods, such as foreach, map, collect, and so on?
>>
>> Best Regards
>>
>> Edmondo
> what exactly is the boilerplate you are trying to template away?
> anyway, you can take a look at the existing templates for for loops

Re: Code templates for IDEA

but you can easily modify them

Am 28.12.2011 20:27, schrieb Donald McLean:
> The existing templates are of the form:
>
> for (a <- bob) { doStuff(a) }
>
> I think the OP is looking for stuff more like:
>
> bob.foreach((a) => doStuff(a))
>
> On Wed, Dec 28, 2011 at 1:26 PM, HamsterofDeath wrote:
>> Am 28.12.2011 16:22, schrieb Edmondo Porcu:
>>> Dear all,
>>> has someone created or knows how to create live templates for most
>>> common scala collection methods, such as foreach, map, collect, and so on?
>>>
>>> Best Regards
>>>
>>> Edmondo
>> what exactly is the boilerplate you are trying to template away?
>> anyway, you can take a look at the existing templates for for loops

Copyright © 2013 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland