Custom autocompletion lists

Hi,

Is it possible to add custom auto complete lists (much like sublime does with .sublime-completions) ?

Thanks!

7 comments

Hello,

Please check live templates reference section.

Denis

0

Hi Denis,
I know about live templates and use them, but I don't see how I can use them to do auto-complete for LUA "classes", which is something that sublime2 does http://sublimetext.info/docs/en/extensibility/completions.html
If indeed live templates would allow this, is there a format that can be generated and read without restarting?

Many many thanks.

0

I see, so the question is to how introduce target text into template. The IDE already provides a notion of 'surround templates', i.e. templates which use text selected at editor. You can combine that with the powerful macros sub-system. The general idea is to write a macros which selects target text and calls target custom surround template and bind it to shortcut.

I've created a small screencast which illustrates the whole process - https://dl.dropbox.com/u/1648086/video/macro-template.m4v

Denis

0

Hi Denis,

Thank you so much for your help, I just have a final question, is there a way to load these from a generated file? The reason for this is that I have hundreds of completions in sublime that I create from the code source when I run a build script.

Thanks again,
P.

0

Sure, all 'surround' templates are stored at $IDEA_CONFIG_HOME/templates/surround.xml file. So, you can do the following:

  1. Create a template manually and check its serialized representation;
  2. Write a simple script which traverses your sublime templates and generates corresponding template section at surround.xml;

Denis

0

Hi Denis,

This got me almost there, the only thing I can't seem to do is have IntelliJ pick up these changes without restarting it. Is there a way to read the xml everytime it builds?

Thanks,
P.

0

Please sign in to leave a comment.