Menu

#469 Indentation wrong for anonymous methods as parameter for another method

Closed
closed-fixed
formatter (27)
5
4 days ago
5 days ago
No

When using the formatter on the following source code, the second var is indented to the same level as the variable below it:

procedure Test(a, b: TProc);
begin

end;

procedure TestCall;
begin
  Test(
    procedure
    var
      a: Integer;
    begin

    end,
    procedure
    var
      a: Integer;
    begin

    end);
end;

Discussion

  • Thomas Mueller

    Thomas Mueller - 4 days ago
    • labels: --> formatter
    • assigned_to: Thomas Mueller
     
  • Thomas Mueller

    Thomas Mueller - 4 days ago

    I tested the code with all formatter configurations (borland, default, delforex, headwork, special, twm) and they all produce correct output - both var keywords are at the same indentation level (4 spaces), and both a: Integer; lines are indented to 6 spaces.

    The formatter output for your test case looks correct (for "Borland" formatting):

    unit testfile_AnonProcVar;
    
    interface
    
    implementation
    
    procedure Test(a, b: TProc);
    begin
    
    end;
    
    procedure TestCall;
    begin
      Test(
        procedure
        var
          a: Integer;
        begin
    
        end,
        procedure
        var
          a: Integer;
        begin
    
        end);
    end;
    
    end.
    

    I cannot reproduce the bug with the code you provided. Could you clarify:

    1. What formatter configuration are you using?
    2. What is the actual output you're seeing? (The exact indentation of the second var)
    3. Is there any additional context in your real code that differs from the example?

    It is possible that the problem has already been fixed. Are you using an older version of GExperts or did you recently compile a new DLL?

     
  • Sebastian Jänicke

    Thank you, I tested with the current version and the error did not occur anymore.

     
  • Thomas Mueller

    Thomas Mueller - 4 days ago
    • status: open --> closed-fixed
    • Group: New --> Closed
     

Log in to post a comment.