Björn Jacobs
Björn Jacobs

Reputation: 4272

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?

Upvotes: 5

Views: 650

Answers (1)

Derlin
Derlin

Reputation: 9871

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.

Upvotes: 1

Related Questions