user18810667
user18810667

Reputation:

IntelliJ IDEA cannot format SQL code properly

I have reinstalled the last version of IntelliJ IDEA and then when I try to format an SQL file, it orders all the lines as shown on the image.

My SQL file

However, I have not made any settings for SQL formatting in the previous versions and the format was OK as shown on my current setting preview as shown below:

My current settings

So, is there anything default to format SQL properly? There are lots of choices in the settings, but I just want to use a default one available on the settings (I tried but it format almost the same).

Upvotes: 6

Views: 3579

Answers (3)

ram
ram

Reputation: 1

pip install mysql-connector (works mostly)

Upvotes: -1

Ricardo Antonio
Ricardo Antonio

Reputation: 21

For me, it works to disable the 'Line breaks' option in the 'Wrapping' tab

Configuration option disable

Upvotes: 1

Mehmet Esen
Mehmet Esen

Reputation: 6876

I faced the same issue. Settings/Languages&Frameworks/SQL Dialects, there you can find the dialect of the file. Change it to what you use.

That's how I solved the problem, even though you apply global or project SQL Dialect, the file may not be updated.

enter image description here

As you can see from the image, Generic SQL causes the problem.

Upvotes: 9

Related Questions