Enable Java editing in String literal with delimiters

I would like to enable Java editing within specific delimiters inside a String literal:

int hour = 5;
String stuff = "It is ${hour} o'clock";

I want text between the "${" and "}" to be editable and highlighted as Java (with completion etc.)  Is there an API I can implement to enable this?

Note I've looked at language injection, but that doesn't seem to support delimiters; it appears to be all or nothing.

Thanks. 

0
2 comments
Official comment

Language injection allows you to inject into some subrange of the string literal. You have to create your own LanguageInjector, perform some preprocessing on the string contents and then call InjectedLanguagePlaces#addPlace with correct range.

Please sign in to leave a comment.