Automatic SQL injection in JavaScript comments
已回答
Hi,
I'm adding SQL statements in my JavaScript comments for documentation and for running these inline queries. I can manually inject SQL language, but I would like the IDE to automatically detect SQL in comments. Here's an example.

You can see that the SQL statement is not recognized in the comment, but it is automatically recognized in the string literal assigned to the "query" prop. I don't need the query prop, it's just here for example.
I tried to guess a custom "Places Pattern" to fix this, but I don't have the IntelliJ internals knowledge, so I failed ;-)

Can this be done?
请先登录再写评论。
It's not possible at the moment as there is no way to tell which comment line is the actual comment and which one is the code.
Related issues:
https://youtrack.jetbrains.com/issue/IDEA-248712/Language-Injection-in-Intellij-Ultimate-for-Commented-Code
https://youtrack.jetbrains.com/issue/IDEA-113589/Add-option-to-inject-language-in-javadoc
Thanks for your response! I added my vote to the related tickets.