Mark a string for SQL highlighting?

Issue

SQL highlighting in IntelliJ 8 is really nice, but it appears it can only be done on strings that are provided to a fixed set of methods (such as Spring's JdbcTemplate methods).

I have a number of convenience methods that I use in my DAOs that execute SQL for me. One of these methods looks like:

public static int queryForInt(JdbcTemplate jdbcTemplate, int defaultVal, String sql, Object... args);
which is similar to JdbcTemplate.queryForInt(), but returns the defaultVal if the query results in no rows.

The SQL string that is provided to a convenience method like this isn't highlighted by IntelliJ because the plugin isn't identifying that the string is eventually provided as a SQL statement to a JDBC query/update method.

Question

Is there a way to mark or annotate:

  • a String variable, and/or
  • a String parameter of a method

so that it is highlighted as SQL?

If not, how about adding this as an ability of the plugin?

Thanks,
~Robert

1
3 comments

Hi Robert,

You can configure all these things though the "IntelliLang" settings.

-tt

0

Small correction...in IntelliJ IDEA 8.0 and 9.0, you can configure this
in "Settings...Language Injection".

0

Just what I was looking for -- Thanks Taras!

~Robert

0

Please sign in to leave a comment.