Looking for Suggestions on Custom Code Completion in Property Files

Hey guys,

I was looking for some suggestions. I am currently working on projects where I use properties type files to set attributes for particular variables used for U.I., database, etc. My question is, I have my own set of attribute definitions I look for in these property files. I would like to set some sort of Suggestion/Code Completion inside the properties file for my own attributes. Here is an example of attributes I declare with its Values:

Name.UI.LABEL = Name Name.UI.WIDTH = 20 Name.FORMAT = STRING Name.FORMAT.MAX_CHARS = 20 Name.FORMAT.REQUIRED = true Name.PERSIST.PARAMETER_NAME = NAME


Ideally, I would like to type Name. Once I type period and press ctrl+space, I would like to see what definitions I can select, e.g. UI, FORMAT, etc. My research has pointed me towards building a plugin, possibly. But, before I dive into that realm, I would like to see if you guys have any other ideas to achieve this.

Thanks in advance!

2 comments

A plugin would allow you to be more robust so you could do the following sequence:

Name.<code-complete>
Name.UI.<code-complete>
Name.UI.WIDTH = 20


But a live template (File > Settings > [IDE Setting] > Live Templates) could also work. Then you would just need to type, for example, name[tab]  (where 'name' is the abbreviation you configure) to select your option. And like code complete, as you type, your available options are narrowed down.

screenshot.png
And it in use:
screenshot2.png
The list narrows down as you type:
screenshot3.png

0

Thanks for the suggestion! I think a plugin might be the best way. Could you point me to a tutorial which could help me create such plugin? I was looking at this one, but Im not sure if this will do what I am looking to develop:

http://confluence.jetbrains.com/display/IntelliJIDEA/Completion+Contributor

Thanks again.

0

Please sign in to leave a comment.