Menu

#154 [Patch] Formatter: more options for uses

None
closed-fixed
None
5
2022-04-03
2022-03-22
No

We're styling the uses section the following way:

uses
  Windows
, SysUtils
, Classes
, Graphics
, Forms
;
  1. break after uses
  2. break after each unit (but before the comma)
  3. only indent the lines not starting with a comma ("Windows" in this example)
  4. break before the semi-colon

The attached patch adds two new options to the formatter (line-break page):
'After "uses"' and 'Before the comma'. The latter as a sub-option for 'Between every unit in "uses"' (like 'Except single lines').

'After "uses"' just adds a break after "uses", to start the "uses"-block.
"Before the comma" adds the line feed before the comma in the uses section instead of after it.
I also removed the fixme regarding NoIndentUsesComma and FeedEachUnit as it (currently) does exactly what I intended when I submitted the NoIndentUsesComma-patch some time ago.

1 Attachments

Discussion

  • Thomas Mueller

    Thomas Mueller - 2022-04-03

    First thing: Please keep in mind that GExperts supports the Delphi versions from Delphi 6 to 11, which means the source cannot use language features that were introduced later than Delphi 6 (unless in code that only is compiled for later versions and which is properly $IFDEFed). You were using inline variable declarations with type inference, which both are a very recent addition to the language.
    After If fixed that, everything compiles in Delphi 2007 (which always is my first test) and also in Delphi 6, 10.2 and 11, so there is no compilation issue.

    I'll now look into the functionality. Did you create a unit test for this?

     
  • Thomas Mueller

    Thomas Mueller - 2022-04-03
    • status: open --> closed-fixed
    • assigned_to: Thomas Mueller
    • Group: -->
     
  • Thomas Mueller

    Thomas Mueller - 2022-04-03

    implemented in revision #3826

    Thank you for your contribution!

     

Log in to post a comment.

MongoDB Logo MongoDB