tuncb / delphi-uses-formatter

VS code extension to format uses sections of Pascal/Delphi code
Apache License 2.0
1 stars 2 forks source link

Option for different uses format #43

Open radkomoder opened 2 weeks ago

radkomoder commented 2 weeks ago

At our team we use a specific uses format, which changes only one line when new uses is added, and it helps a lot with conflicts when merging different branches. When doing blame, each line is directly linked to the commit when the unit was introduced.

Our format is:

uses
    Unit1
  , Unit2
  , Unit3
  , Unit4
  ;

Is there a way we can edit the code template ourselves?

radkomoder commented 2 weeks ago

I already changed the way it works to suit our needs. The modified code are last 2 lines in formatUsesSection:

    const formattedUnits = units.sort(sortFun).join(`${lineEnd}${separator}, `);
    return `uses${lineEnd}${separator}$  ${formattedUnits}${lineEnd}${separator};`;

Thanks for a nice plugin!