Dan T
05/11/2022, 10:30 PMSet mode to SQL
If a val has the word "where" in it
And is in a kotlin class with "Repository" in its name
I see something that looks similar for javascript, which is this:
+ jsLiteral().withStringValueIgnoringInterpolations(stringMatchesBrics(" *(SELECT|DELETE) .*FROM .*"))
but I don't know how to translate that to looking at a variable in Kotlin.
The result is that I'd like to be able to get automated SQL language support for variables that look like SQL in a repository class. I know I can add
//language=sql
val someStatement="select * from foo where x=?"
...but with a dozen statements in a repository, all those language comments are pretty cumbersome. Thanks for any advice!Rob Elliot
05/12/2022, 7:26 AMDan T
05/12/2022, 8:20 PMsql
. So I created this SQL language injection rule:
+ kotlinParameter().withName("sql")
I then set it to be project-scoped so that I could save its .idea/IntelliLang.xml
file in source control with the project so other people didn't need to manually add it.