Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply an intention to a whole file

I have a large SQL file where the identifiers are not quoted. IntelliJ IDEA suggest the intention to "Quote identifier". I can do this one by one but this is very cumbersome since I have a lot of different identifiers there (database names, table names, fields).

Using the Analyze/Run inspection by name command, I can select the "Identifier should be quoted" analysis to my whole file. But this analysis does not yield any result for some unknown reason. The result of the analysis is "No suspicious code found".

I also defined an exact scope of the files I want to apply the intention on, but it didn't help - same result.

How can I achieve the application of the intention multiple times at once?

like image 267
Björn Jacobs Avatar asked Nov 10 '22 04:11

Björn Jacobs


1 Answers

I don't know how to apply intentions actions in batch (I don't even know if this is possible), but for your problem you can do:

  1. Open Settings > Editor > SQL. In the general tab, find the option Identifier quotation and set it to Quote. Click apply.
  2. Open your file and reformat it (Code > Reformat Code or Ctrl+Alt+L).

It should normally add quotes to all the identifiers in the file.

like image 181
Derlin Avatar answered Nov 14 '22 21:11

Derlin