How to create a new group under Live Templates?

Hi,

Would anyone know how I can create a custom group (as the top level tree) name to orgainze my own Live Templates under Settings?

Also I found the name "other" is very misleading for many of the Java templates. Shouldn't these be named "Java"? I am suprised that "Java" name is not even in the list!

Zemian

5 comments
Comment actions Permalink
Also I found the name "other" is very misleading

That is there because of some historical reasons I think. Select it, right click, select rename. Problem solved ;)

Would anyone know how I can create a custom group

I do not know of a way via the UI. But you can hack one:

  1. Shut down IntelliJ IDEA
  2. Go to ~/.IntelliJIdea12/configs/templates
    1. see http://devnet.jetbrains.net/docs/DOC-181 if you need assistance finding your configs directory.
  3. Create an XML file with the minimalistic content shown below.
    1. You must have at least one template for it to show in the IDE
    2. The 'group' attribute is the name of the group shown in the IDE
  4. Start IDEA
  5. Add templates to the group and then delete the placeholder template.


  6. <?xml version="1.0" encoding="UTF-8"?>
    <templateSet group="My Group Name">
      <template name="x" value="x" description="x" toReformat="true" toShortenFQNames="true">
        <context />
      </template>
    </templateSet>


0
Comment actions Permalink

Cool. thanks for the details info Mark!

I think IntelliJ should provide a button to support such a simple feature more easily for users. :)

0
Comment actions Permalink

You can do it in UI -- it's just not obvious at all.

This is the ticket to make it possible (if it ever gets implemented): http://youtrack.jetbrains.com/issue/IDEABKL-6464

Current workflow is:

  1. Create new Live Template anywhere (in any group)
  2. Right click on it and choose "Move | New Group"
0
Comment actions Permalink

Nice Andriy. Thanks. I did not know that. As you say, it's not obvious.

0
Comment actions Permalink

Thanks for this tips Andriy!

I have actually opened an feature request for this: http://youtrack.jetbrains.com/issue/IDEA-98527 before your reply. I have just now updated with your related issue as well.

0

Please sign in to leave a comment.