Skip to main content

Add formatting option to place "do" on same line as "then"/"for each ..."/etc.

In my opinion, the current formatting for PowerOn files adds a lot of visual noise by giving do…end blocks their own indentation. In most coding languages, it is standard to put braces on the same line/indentation as the flow-control statement they’re attached to, and I think it would make sense to at least have that as an option in PowerOn Pro.

For comparison, here is the current style enforced by the extension:

if x = 5 then
if x = 5 then do
    [etc.]
end

for each share with 
Status: Completed3 comments

Comments3

  • Dylan Martinez changed status to In Progress
    Team•

    Jun 26

    Pinned

    This will be available in v1.10

  • Dylan Martinez changed status to Planned
    Team•

    May 8

    Pinned

    For sure, we’ll get this added. Thanks for the idea & submission.

  • Zebulan

    •

    May 8

    In my opinion, the current formatting for PowerOn files adds a lot of visual noise by giving do…end blocks their own indentation. In many coding languages (e.g. Go, JavaScript, PHP, Rust, Zig), it is standard to put braces (the equivalent of PowerOn’s do…end) on the same line/indentation as the flow-control statement they’re attached to, and I think it would make sense to at least have that as an option in PowerOn Pro.

    For comparison, here is the current style enforced by the extension:

    if x = 5 then
      do [etc.]
      end
    
    for each share with (share:type = 1)
      do
        [etc.]
      end

    And here’s what I would prefer to have as an option:

    if x = 5 then do
      [etc.]
    end
    
    for each share with (share:type = 1) do
      [etc.]
    end

    (Side note: I would recommend using 4 spaces for indentation rather than 2 when using this latter style; of course, PowerOn Pro already supports changing the indentation size, so that part is already covered.)