SQL Code Style Settings
Answered
I haven't changed my settings in a long time, hence not sure whether I may have changed unintentionally, or new behaviours have been added that need to be configured.
1. No indentation after a comma
When I write CTES:
WITH test AS (
),
| <-cursor gets indented, I would prefer for it to go to the back of the line
2. Indentation of whole subquery
At the same time, when I type closing bracket, the code gets indented. I am sure this wasn't happening before but can't figure out how to change it. Let's say I start with this code:
WITH test AS (
SELECT
*
FROM table
INNER JOIN active USING(something_id)
WHERE
start_date BETWEEN '2022-07-01' AND '2022-07-31'
And after pressing the closing bracket it does the following:
test AS (
SELECT *
FROM table
INNER JOIN active
USING (something_id)
WHERE
start_date BETWEEN '2022-07-01' AND '2022-07-31'
)
If possible I would only like to ident all code as one block
test AS (
SELECT
*
FROM table
INNER JOIN active USING(something_id)
WHERE
start_date BETWEEN '2022-07-01' AND '2022-07-31'
)
Please sign in to leave a comment.
1. Preferences | Editor | Code Style | SQL | General | Queries | Subquery | Place the closing parenthesis set to "Do not change"
2. Check the code style settings for SELECT, FROM, and WHERE in the same screen
Thanks Konstantin, the number 1 worked all right but can't figure out the number 2. I tried to set Place Subquery = Do Not Change but my code is still being changed
I mean that there is no exact setting for the whole subquery indentation. It is needed to adjust the code style for every statement (SELECT, FROM, WHERE) in the subquery and change its indentation.