Jump to content
pustekuchen

Formatter line wrapping and indention

Recommended Posts

Hello

 

we are actually formatting our whole codebase. GExpert seems to be the most viable solution for this task (Standalone Execution via command line is possible, still maintained and most options).
After formatting our code, we found some cases, where the formatter fails or i would expect another result.

 

https://sourceforge.net/p/gexperts/bugs/366/

https://sourceforge.net/p/gexperts/bugs/367/

https://sourceforge.net/p/gexperts/bugs/368/

 

1. Multiple formatting of the same file leads to different results, if WrapLongLines (100 Lines) is actived

 

Example 

unit Unit1;

interface

type
  TSampleClass = class(TObject)
    procedure thisisaverylongfunctionnametoshowaproblemwithlinewarpping_12345678910111213(); virtual;
  end;

implementation

end.

Formatted once:

    procedure thisisaverylongfunctionnametoshowaproblemwithlinewarpping_12345678910111213();
      virtual;

Formattet twice

    procedure thisisaverylongfunctionnametoshowaproblemwithlinewarpping_12345678910111213();
    virtual;

I would expect the same result, if the file gets formatted multiple times. (Use Case: automatic calling the formatter before commiting files or calling in a pipeline job)

 

2. Missing indent for multiline comments

 

Option: Indend Comments active

 

  TSampleClass = class(TObject)
    procedure functionx(); { this is multiline comment
    ---- ----- ---- --------------------------------- -- -------
    ----------
    ----
    }
    procedure functiony();                   //test
  end;

Expected

  TSampleClass = class(TObject)
    procedure functionx(); { this is multiline comment
      ---- ----- ---- --------------------------------- -- -------
      ----------
      ----
      }
    procedure functiony();                   //test
  end;

3. Unessesarry line wraps are not removed

 

WrapLongLines (100 chars)

Input

procedure TSampleClass.functionx;
var
  test: string;
begin
  test := 'this is just a very long string 12345678789012345'  + 'this is another very long string for '
  + 'example';
end;

Output

procedure TSampleClass.functionx;
var
  test: string;
begin
  test := 'this is just a very long string 12345678789012345' +
    'this is another very long string for '
  + 'example';
end;

Expected (Indend + Remove uncessesary line wrap)

procedure TSampleClass.functionx;
var
  test: string;
begin
  test := 'this is just a very long string 12345678789012345' +
    'this is another very long string for ' + 'example';
end;

For now we would not activate the "Wrap Long lines" option, because of this behavior. It would be nice, if this could be fixed.

Edited by pustekuchen

Share this post


Link to post

Thanks for filing the bug reports. I can't promise anything regarding when they will be fixed.

Share this post


Link to post
Posted (edited)

Thank you for fixing #1. When will the next version be released?

Edited by pustekuchen

Share this post


Link to post

No idea. I currently don't find the time to do anything on it.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×