Datagrip language injection

Answered

HI I like Jet-brains tools ever since I started using them many year ago and one features I like is language injection now I using Datagrip to work on an Oracle Apex application and a lot of the sql I need to write depends on a condition so I need to use oracle q'~ which is a string value to sql but it contains sql code.

So each day when I open Datagrip and I start to edit my code I have to use the mouse to rightclick the qualified string and use the context menu to inject oracle sql.

 

So my question is can I setup datagrip to always inject sql when it finds  q'~ SOME CODE ~;  I tried looking at the injection setting in datagrips settings but was not able to work out what I need to do.

4 comments

@jason kristian

Have you tried to add new injection in `Editor -> Language Injections`?

1

thank I know the setting page what my question was is how it works, I tried to copy one of the injection or sql type but I could not do it.

Example, So I want the start of my inject to be q'~ and the end to be ~'; and anything in between should be sql.  But I could not find any docs on the regex that the setting pages uses.


q'~
select sysdate from dual
~';
0

Ive still not been able to do this. It looks like you need be an expert in PSI . I can not see a way to add this Ive looked that the injections that are there by default and from that I still have not been able to work out what to do. This is a common practise when working with oracle or oracle apex to  have a function return a quoted string which is a query, I use this alot and I hate having to inject oracle sql into the quoted text via context menu each day as soon as I close Intelij or open and close projects all manually added injection get cleared. 

The current method to add a injection seams very complicated that I could not work it out, I don't work on the open source Intelij project so having to know its internals to add a language injection.

 

Can someone please help I'm sure if you are a team member you would be able to do this real quick but there is no docs for every one else , the help files only tell you where to find the menus to create injection not how to create them. 

0

Please sign in to leave a comment.