CTE formatting in DataGrip 2018.2
Answered
Previously, CTEs in my code were always wrapped and indented like this:
WITH test AS (
SELECT *
FROM table
WHERE condition
)
SELECT *
FROM test;
Now, in DataGrip 2018.2, I always end up with this:
WITH test AS (SELECT *
FROM table
WHERE condition)
SELECT *
FROM test;
I strongly prefer the first one but after hours of fiddling with the new Code Style settings, I cannot find a way to get the formatting to how it used to be. There are settings for subqueries, but these don't seem to apply to CTEs. Can you please advise/fix this?
Please sign in to leave a comment.
You're welcome to watch/vote for the issue https://youtrack.jetbrains.com/issue/DBE-6798
+1 This is very annoying.. I have also fiddled with the settings for quite some time now.
It seems that CTE's are not recognized as subqueries!
A fix will be available in a EAP build or in DataGrip 2018.3.
The fix doesn't seem to work in 2018.3. I set "Place elements on" to new line. But it doesn't seem to take
How to get the mentioned style in DataGrip 2018.3:
Ok this is great. Some what off topic but I have my SELECT to elements on new line now as well. I'm finding the first element is not lining but the following elements. Looks some what like this:
SELECT
a.column
, a.column2
, a.column3
I'd like:
SELECT
a.column
, a.column2
, a.column3
Any way to make this happen? (loving the new styles features though)
Hmm, such style is not supported yet (we're not testing our formatter with such style — so you cannot assume it will work in future releases even if you manage to setup it in the current one). Please file a feature request :)
Got a link :)?
???
For where to submit the feature request
@Jon Falco89 follow the link https://youtrack.jetbrains.com/newissue?project=DBE