Inject languate in Scala-string?
Hi.
Is it possible to make IDEA understand SQL-queries in Scala-strings and the like? This is really a feature I miss from the java-world. Editing large JPA-queries is *so* much easier with code-completion in the query.
--
Andreas
Please sign in to leave a comment.
This has just been implemented. You need to use a nightly build, with IDEA X to use it.
http://twitpic.com/3bnrj9
-jason
Nice.
I now use IDEA-X 98.510 with scala-plugin-0.4.311 and it sort of works, although I have to manually inject language (ALT+Enter).
I see it breaks in concatenated strings, f.ex. in strings like:
"SELECT a FROM A a" +
" WHERE a.sid = :sid"
IDEA marks the " WHERE" string as invalid ("SELECT expected...").
I wonder why I have to manually inject it. Is it because the scala-plugin doesn't recognize my entity-manager (annotated with @PersistenceContext) as being an EntityManager? I will post a separate issue on this.
Nice to see progress being made! I use the Spring framework heavily (annotation-based) and more support for it in the scala-plugin is very welcome from me at least.
--
Andreas
Use multiline strings for now.
"""select *
from dual"""
More details here: http://devnet.jetbrains.net/message/5278597#5278597
http://youtrack.jetbrains.net/issue/SCL-2512
Observation:
Language injection works correctly when there is one String like this (don't have to manually trigger either it with ALT+Enter):
c.createStatement.execute("SELECT count(*) FROM fish")
But breaks, not being activated with concatenated Strings like:
c.createStatement.execute("SELECT count(*) FROM fish" +
" WHERE id > 100")
Should I file an issue on YouTrack for this or is it a known bug/issue (which I bet it is)?
--
Andreas
You posted while I was writing a new post, didn't see your reply in time...
Ok, so multiline strings work.
I have lots of dynamicly generated queries so in many cases multiline strings are not possible, but I bet this will come in "near" future:-)
--
Andreas
It's known. But if you create issue, you will show that you are interested in this feature very match, and you will be able to watch progress on this issue. So you can always create an issue when you want to do it. It's really very helpful.
Best regards,
Alexander Podkhalyuzin.
Ok, here is the ticket: http://youtrack.jetbrains.net/issue/SCL-2545