Suggestion: Support placing commas at the start instead of at the end

guttormvik

Member²
If I use code completion of a procedure call, commas are placed at the end of the line. I'd prefer them at the start.

SQL:
begin

    -- default behavior:
    sys_translation.add
        ( ptoken     => XXXX,
          pnorwegian => XXXXXX,
          penglish   => XXXX);

    -- desired behavior:
    sys_translation.add
        ( ptoken     => XXXXX
        , pnorwegian => XXXXXXX
        , penglish   => XXXXX
        );

end;

Btw, I'm pleased to see that code completion in plyxon worked even if I placed the starting parentesis on the next line. In pl/sql developer you have to put it on the same line, and then everything is indented accordingly.

I assume you will move over the Beautifier as well? In that case, I'd prefer this in select statements as well:

SQL:
select p.first_name
     , p.last_name
     , p.date_of_birth
     , pa.address1
  from t_person p
     , t_person_address pa
 where pa.person_id = p.person_id
   and p.first_name = 'John'
   and exists
       ( select null
           from t_person_booking pb
          where pb.person_id = p.person_id
       )
   and ...;

having "and" at the start is a pretty common convention, and to me, having *all* separators at the start is an obvious extension of that.
If a rationale is needed, mine is that trailing commas (or trailing anything) becomes individual tokens I must read. Having them aligned at the start means that they visually become one "token".

In the examples, you can also see that I place starting parenthesis at the start, and ending parenthesis aligned with it.
I find this essential for large selects with multiple nested expressions.
 
There is a Code Assistant preference page where you can control the comma placement.

We have indeed already received several requests to include the PL/SQL Beautifier.
 
Doh! Must get my eyesight checked. With that it is so close..

SQL:
begin

    -- default behavior:
    sys_translation.add
        ( ptoken     => XXXX,
          pnorwegian => XXXXXX,
          penglish   => XXXX);

    -- with "place comma before item" config
    sys_translation.add
        ( ptoken     => XXXX
         ,pnorwegian => XXXXXX
         ,penglish   => XXXX);

    -- desired behavior:
    sys_translation.add
        ( ptoken     => XXXXX
        , pnorwegian => XXXXX
        , penglish   => XXXXX
        );

end;
 
Back
Top