Re: WIP: SQL Formatter

Поиск
Список
Период
Сортировка
От Aditya Toshniwal
Тема Re: WIP: SQL Formatter
Дата
Msg-id CAM9w-_m=N08fBSTJ=toiuZaLxkQ+qhDz1nA0y+LVAVOLHCBnzg@mail.gmail.com
обсуждение исходный текст
Ответ на WIP: SQL Formatter  (Dave Page <dpage@pgadmin.org>)
Ответы Re: WIP: SQL Formatter  (Dave Page <dpage@pgadmin.org>)
Список pgadmin-hackers
Hi Dave,

On Wed, Jul 29, 2020 at 9:34 PM Dave Page <dpage@pgadmin.org> wrote:
The attached WIP patch adds a menu option to the Query Tool to format the SQL in the editor. It does so per options that can be set in the Preferences panel (essentially, most of these: https://sqlparse.readthedocs.io/en/latest/api/#formatting-of-sql-statements)

Some thoughts before I continue:

- There are already options for tabs vs spaces and tab width for the query tool. At the moment I've intentionally kept separate settings for the same thing in the formatter. If we use the same options it'll mean that configuration for formatting is split across two places in the Preferences panel. On the other hand, it may be handy to have separate options. What do others think?
I'm not aware of any editor who is having separate settings for formatting. Editors like VS code use .editorconfig for the auto format option. I would also suggest having common editor settings for both formatting and user input.

- I'm thinking that maybe we should push all user-visible generated SQL through the formatter. This would essentially mean that all get_sql and similar functions would call it. We'd probably need to make the re-sql test suite call it as well. Does this seem like a good idea? It's be a fairly widespread change, but it would mean that the resql and generated crud statements would be consistently formatted, to the user's preferences.
Yes we can. But should we use it for function/proc body ? Users may not like their function being altered.

Thanks.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EDB: http://www.enterprisedb.com



--
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"

В списке pgadmin-hackers по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: WIP: SQL Formatter
Следующее
От: Akshay Joshi
Дата:
Сообщение: Re: Sonarqube fixes - test_utils.py