Open API request

 Hi guys,

I'm implementing a Mybatis plugin. There are some annotations (@Select, @Delete, etc. ) in Mybatis that accept an array of strings as arguments, these strings are concatenated with a single space to form a complete SQL statement. I want to inject SQL language into these strings. Currently, SQL can only be injected in a string separately, which is not the Mybatis case.

So I have to find a way to concatenate the strings as single SQL. After a look at the open source code, I think I know that com.intellij.psi.impl.source.tree.injected.JavaConcatenationInjectorManager$Concatenation2InjectorAdapter does something like that. But this class has the first order without an id, so I have no chance to interact with the injection subsystem.

Can anyone help me a little bit, please?

0
2 comments
Avatar
Permanently deleted user

I think you'll need to implement com.intellij.lang.injection.MultiHostInjector

and in its com.intellij.lang.injection.MultiHostInjector#getLanguagesToInject method call 

registrar.addPlace

several times for each annotation.

0

Thank you so much for your tip, I tried it and it did work. Thank you again.

0

Please sign in to leave a comment.