project-aware live templates?

I often switch back and forth between projects, only some of which use generics. It would be nice if my "itco" live template (and many others) could use generics in some projects and not in others, although I'm not sure how to accomplish this. Any ideas?

Probably the simplest would be to have different live template profiles, similar to code style, keymap, etc.

4 comments
Comment actions Permalink

Default live templates should work both for generics and 1.4 code.
Eugene.

"schmoe" <schmoe@messageone.com> wrote in message
news:31342681.1086706332164.JavaMail.itn@is.intellij.net...

I often switch back and forth between projects, only some of which use

generics. It would be nice if my "itco" live template (and many others)
could use generics in some projects and not in others, although I'm not sure
how to accomplish this. Any ideas?
>

Probably the simplest would be to have different live template profiles,

similar to code style, keymap, etc.


0
Comment actions Permalink

Agreed, but in the abstract, wouldn't you expect to have some common operations that you'd do differently in different projects? If "itco" with/without generics isn't a reasonable enough case, what about a custom live template that inserts code to grab a database connection? In two of my projects, there are slightly different ways to grab and return a database connection.

I don't think it makes sense for Idea to try to understand all the intracacies of my projects, and which definition of a live template makes sense for the current project. But if I had several sets of live templates, and could switch between them like I do with code styles, it would make my life somewhat simpler. I'll let JetBrains evaluate the cost/benefit and whether it belongs in Idea, but this would let us avoid writing least-common-denominator live templates.

0
Comment actions Permalink

Agreed in general, with one question: is it just out of question to have 2
templates with different abbreviations?

Eugene.

"schmoe" <schmoe@messageone.com> wrote in message
news:23034862.1086788750080.JavaMail.itn@is.intellij.net...

Agreed, but in the abstract, wouldn't you expect to have some common

operations that you'd do differently in different projects? If "itco"
with/without generics isn't a reasonable enough case, what about a custom
live template that inserts code to grab a database connection? In two of my
projects, there are slightly different ways to grab and return a database
connection.
>

I don't think it makes sense for Idea to try to understand all the

intracacies of my projects, and which definition of a live template makes
sense for the current project. But if I had several sets of live templates,
and could switch between them like I do with code styles, it would make my
life somewhat simpler. I'll let JetBrains evaluate the cost/benefit and
whether it belongs in Idea, but this would let us avoid writing
least-common-denominator live templates.


0
Comment actions Permalink

Not at all - that's a very reasonable workaround, and that's what I'm currently doing. In my mind, it's similar to the Enter behavior respecting the code context and the current code style - if I type a { and hit Enter, different things will happen depending on the currently-selected code style. It's easy enough to hit Enter and the appropriate number of spaces or tabs, but Idea lets Enter mean "new line and correct indentation", where that definition depends on the current settings.

That analogy is a bit of a stretch, but it's generally the way I'd like to think about live templates.

0

Please sign in to leave a comment.