How to add properties autocomplete to FreeMarker templates?

Hi,

what would be best way to implement properties autocomplete in FreeMarker templates? I would like to have something like that:

${bundle("<autocomplete in here>")}

I created CompletionContributor, but I don't know how to get LookupElements for existing properties in a project.

Thanks,
Regards,
Pavel

2 comments

See PropertyReferenceBase.getVariants() for the standard implementation of property completion. You can reuse it by creating an instance of PropertyReferenceBase and calling its getVariants() method directly in your completion contributor.

0

Thanks, I got it working. Now if I want not only:

${bundle("<autocomplete in here>")}

but also:

${bundle("{<autocomplete in here>")}

what should I do? I didn't find way to alter position's text.

0

Please sign in to leave a comment.