Intellij Idea Dart SQL Injection

Viewed 183

Intellij Idea has this feature called Language Injection, which allows you to have syntax highlighting for one language into another, such as having syntax highlighting for SQL inside a String when editing a java file.

I want to allow this to work with Dart, i.e. allow me to syntax highlight Strings with SQL in Dart automatically when I call a certain function. However this is not possible, as the only languages it allows injection FROM are those:

language inject

Is it possible to allow injections in a dart (or just for the sake of it any custom language), and if it isn't what resources can I look into for writing a plugin to do this, or modifying the existing built-in IntelliLang plugin?

EDIT:

I'm very well aware that it can be done manually for each string by pressing alt+enter, selecting inject language or reference and selecting sql, but this is unnecessarily tedious

1 Answers

See the comments here: https://youtrack.jetbrains.com/issue/WEB-38875

Here are some quotes:

currently we only support injection by comment for the string literal on the next line.

It's possible to write a custom IntelliJ / WebStorm plugin with MultiHostInjector implementation that would support any custom annotation or whatever syntax for injection in Dart string literals.

Related