Re: WIP: SQL Formatter

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: WIP: SQL Formatter
Date: 2020-08-07 15:58:00
Message-ID: CA+OCxozO_545jM4euiRk+AY0eRtk4ei-uzboOO5jJuDdGhXBFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Mon, Aug 3, 2020 at 10:51 AM Aditya Toshniwal <
aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:

> Hi,
>
> On Mon, Aug 3, 2020 at 3:06 PM Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>>
>>
>> On Mon, Aug 3, 2020 at 10:31 AM Aditya Toshniwal <
>> aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:
>>
>>> Hi,
>>>
>>> On Fri, Jul 31, 2020 at 6:03 PM Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>>
>>>> Hi
>>>>
>>>> Currently, all the CodeMirrors in pgAdmin use the settings from the
>>>>> Query tool -> Editor, even though they're not related. I think
>>>>> you're right. We should move all CodeMirror settings out of the Query tool
>>>>> and move it to a new node - "SQL" may be. Editor and Auto-format would be
>>>>> sub nodes under SQL. With that, the editor settings will apply at all the
>>>>> places where CodeMirror editing is used(function body, query tool). What do
>>>>> you say ?
>>>>>
>>>>
>>>> Turns out that's more work than I really have time for at the moment,
>>>> because it means making the editors be able to handle automatic reloads of
>>>> multiple preference sections. We can always think about moving the
>>>> formatting preferences into their own section later.
>>>>
>>>> In the meantime, this update to the patch does what was originally
>>>> suggested and puts the options into a Query Tool -> SQL Formatting section.
>>>>
>>> Cool.
>>>
>>>>
>>>> Comments? Obviously docs will need updating too, once we're all happy
>>>> with the basics.
>>>>
>>> It works nice. A shortcut and auto format only selected text would be
>>> helpful.
>>>
>>
>> Yeah, the shortcut crossed my mind. Any thoughts on what it could be? I
>> was struggling to find something that made sense and wasn't used by Chrome
>> or elsewhere.
>>
> I can only find Shift+Cmd+K available.
>
>>
>> Formatting only the selected text might be troublesome; it may create
>> some very strange results if a partial statement is selected.
>>
> Formatter should not be blamed in that case. It did what was asked. :P
>

*shrug*. OK. How's about this?

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

EDB: http://www.enterprisedb.com

Attachment Content-Type Size
SQL_Formatting_v3.patch application/octet-stream 12.9 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Cyril Jouve 2020-08-09 22:55:03 Use python3 ipaddress module to validate ipaddress
Previous Message Rahul Shirsat 2020-08-07 14:30:09 Bug #5664 SQL DDL output generator for view