How to add a SQL dialect?
Answered
Hello there,
We use PhpStorm actively and we have our wrappers for work with DB (MySQL). The thing is that when we use placeholders, SQL is stopped being highlighted.
$sql = 'UPDATE #t:queue_table# SET moderator_id = null, lock_until_ts = #ts:default_ts#';
This code is not recognised as SQL, so highlighting doesn't work.
I would like to enable the highlight for this
Please sign in to leave a comment.
This is because SQL syntax is not recognized anymore. You can enable it by using Use language injection comments.
Hi @Jakub, thanks for the answer.
It's a good solution but I intentionally posted it into "Plugin Development" community, not to Phpstorm Support. Could you please move it back?
This advice is close to what I want but we have thousands of queries in the code, if we add such comments to all of them, it will be a mess. Moreover, we won't change all our code to comply this, it's too much work
If there are such comments, there must be a way to force the injection automatically using in a plugin, right? I would like to know this way :)
It doesn't belong to the Plugin Development - as far as I see, you're not working on such plugin but just noticed an area to enhance the existing plugin, right?
Please file an issue in our YouTrack.
Not quite, I am developing a plugin customizing PhpStorm for our repository and this is the feature I wanted to add.
I really was to create the post in Plugin Development, probably a misclick happened or somebody moved it here.
Ok, but your question didn't contain any SDK-related part. Can you rephrase your problem then?
Actually, in the subject, I was asking a way to add a new SQL dialect it does sound like a plugin feature :) Currently, I think of creating my own Injected Language but I really think it's worth to re-use existing mechanism if possible.
Now I see a second option - force the SQL Language injection automatically based on my heuristics. It also can be a solution.