Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-04

Class completion incorrectly written for interfaces

10 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I created a interface definition as show below. Note that both Getter methods are still missing.

   IMVPModel = interface(IInterface)
   ['{85223140-B263-4413-89E3-BFA37E9D3112}']
     property CommandSet: ICommandSet read GetCommandSet;
     property CurrentSelection: ISelection read GetCurrentSelection;
   end;

I then pressed Ctrl+Shift+c in the Lazarus editor to complete the definition. Lazarus then inserted the Getter methods above the GUID. It's not a biggy, just a little bit annoying. ;-)

   IMVPModel = interface(IInterface)
     function GetCommandSet: ICommandSet;
     function GetCurrentSelection: ISelection;
   ['{85223140-B263-4413-89E3-BFA37E9D3112}']
     property CommandSet: ICommandSet read GetCommandSet;
     property CurrentSelection: ISelection read GetCurrentSelection;
   end;

Above code should have looked as follows:

   IMVPModel = interface(IInterface)
   ['{85223140-B263-4413-89E3-BFA37E9D3112}']
     function GetCommandSet: ICommandSet;
     function GetCurrentSelection: ISelection;
     property CommandSet: ICommandSet read GetCommandSet;
     property CurrentSelection: ISelection read GetCurrentSelection;
   end;

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Mattias Gärtner: An embedded and charset-unspecified text was scrubbed... Name: not available Url:…
Mattias G?rtner wrote 8 lines
Zitat von Graeme Geldenhuys : > Submitted to mantis as: > http://bugs.freepascal.org/view.php?id=11158 Fixed in svn 14850. At the moment the bug tracker is not responding, so I can't update it.

Thanks Mattias. It places the code correctly behind the GUID, but the indentation is now wrong. I looked in the SVN logs to see what you changed, and to try and create a patch myself. But I'm afraid the code completion unit is the most cryptic I have seen - so I have no clue as to what needs to change. ;-)

Here is an example of the output now:

   ITest = interface(IInterface)
   ['{F5FF79F8-F29F-4861-A5D3-2905C86AE235}']
   function GetAge: integer;
   function GetName: string;
   procedure setName(const AValue: string);
     property Name: string read GetName write setName;
     property Age: integer read GetAge;
   end;

And how it should have looked:

   ITest = interface(IInterface)
   ['{F5FF79F8-F29F-4861-A5D3-2905C86AE235}']
     function GetAge: integer;
     function GetName: string;
     procedure setName(const AValue: string);
     property Name: string read GetName write setName;
     property Age: integer read GetAge;
   end;

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
Thanks Mattias. It places the code correctly behind the GUID, but the indentation is now wrong. I looked in the SVN logs to see what you changed, and to try and create a patch myself. But I'm afraid the code completion unit is the most cryptic I have seen - so I have no clue as to what needs to change. ;-)

I tried swapping the two lines inside the if statement block, which fixes the indentation, but then sometimes the Getter and Setter methods appear after the property line in the interface definition. So I don't think that's the correct solution.

    if (ANodenil) and (ANode.Desc=ctnClassGUID) then begin
      ANode:=ANode.NextBrother;
      InsertNode:=ANode;
    end;

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Mattias Gaertner
to Graeme Geldenhuys: Thanks Mattias. It places the code correctly behind the GUID, but the indentation is now…
Show quoted text 39 lines
Mattias G?rtner wrote: > Zitat von Graeme Geldenhuys : > >> Submitted to mantis as: >> http://bugs.freepascal.org/view.php?id=11158 > > Fixed in svn 14850. > At the moment the bug tracker is not responding, so I can't update > it. > Thanks Mattias. It places the code correctly behind the GUID, but the indentation is now wrong. I looked in the SVN logs to see what you changed, and to try and create a patch myself. But I'm afraid the code completion unit is the most cryptic I have seen - so I have no clue as to what needs to change. ;-) Here is an example of the output now: ITest = interface(IInterface) ['{F5FF79F8-F29F-4861-A5D3-2905C86AE235}'] function GetAge: integer; function GetName: string; procedure setName(const AValue: string); property Name: string read GetName write setName; property Age: integer read GetAge; end; And how it should have looked: ITest = interface(IInterface) ['{F5FF79F8-F29F-4861-A5D3-2905C86AE235}'] function GetAge: integer; function GetName: string; procedure setName(const AValue: string); property Name: string read GetName write setName; property Age: integer read GetAge; end;

The codetools have only a rudimentary code formatter that assumes that the GUID is indented like many interfaces in the RTL. A real code formatter is planned.
Maybe a minimum indentation relative to the class/interface node can be added.

Mattias

Reply by email

Graeme Geldenhuys
to Mattias Gaertner
Mattias Gaertner wrote
The codetools have only a rudimentary code formatter that assumes that the GUID is indented like many interfaces in the RTL. A real code formatter is planned.

No problem, in that case I'll manually fix the indentation or simply indent the GUID line. No issues. Thanks again for you quick response.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email