Re: [lazarus] Code completion formatted code incorrectly
On 1/19/07, Mattias Gaertner [EMAIL PROTECTED] wrote: Ah. This explains. What Delphi calls 'Code completion' is called under Lazarus 'Identifier completion'. And 'Code completion' under Lazarus is a bunch of features including 'Class completion'. See http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools Fixed. Ah, ok. Sorry about the mixup and thanks for the quick fix. -- Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342' _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On Thu, 18 Jan 2007 17:29:55 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: On 1/18/07, Mattias Gaertner [EMAIL PROTECTED] wrote: So, the bug is somewhere in the normal class completion. I added some more verbosity. I did the same reverse class completion test as before. Here is the console output. --- [graemeg-linux] lazarus ./lazarus TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32 TCodeToolsOptions.AssignTo DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TCodeCompletionCodeTool.CompleteCode DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=procedure TLearner.Save; begin inherited Save; end; TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=function TLearner.IsValid(const AErrors:TtiObjectErrors):boolean; begin Result:=inherited IsValid(AErrors); end; TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=destructor TLearner.Destroy; begin inherited Destroy; end; TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=constructor TLearner.Create; begin inherited Create; end; TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=procedure TLearner.AssignClassProps(pSource:TtiObject); begin inherited AssignClassProps(pSource); end; TMainIDE.DoSaveAll TMainIDE.DoSaveProject End TProject.SomethingModified SessionModified TMainIDE.DoSaveProject End TMainIDE.DoCloseEditorFile A PageIndex=7 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=6 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=5 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=4 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=3 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=2 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=1 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=0 TMainIDE.DoCloseEditorFile end LAZARUS END - cleaning up ... [TMainIDE.Destroy] A [TMainIDE.Destroy] B - inherited Destroy... TMainIDE [TMainIDE.Destroy] END [graemeg-linux] lazarus --- Hope that made sense to you... :) No. Where are the lines 'CreateMissingProcBodies InsertProcBody'? It does not add any procedure, does it? Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On 1/19/07, Mattias Gaertner [EMAIL PROTECTED] wrote: Hope that made sense to you... :) No. Where are the lines 'CreateMissingProcBodies InsertProcBody'? It does not add any procedure, does it? Yes it created the stub in the interface section. I just got another update (r10478) and tried it again. Again it created the stub in the interface section (reverse code completion). Doing class completion to override a method still creates the wrongly formatted text though. Here is my latest console output: - [graemeg-linux] lazarus ./lazarus TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32 TCodeToolsOptions.AssignTo DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TCodeCompletionCodeTool.CompleteCode DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TProject.SomethingModified SessionModified TMainIDE.DoSaveProject End TMainIDE.DoCloseEditorFile A PageIndex=8 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=7 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=6 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=5 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=4 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=3 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=2 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=1 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=0 TMainIDE.DoCloseEditorFile end LAZARUS END - cleaning up ... [TMainIDE.Destroy] A [TMainIDE.Destroy] B - inherited Destroy... TMainIDE [TMainIDE.Destroy] END [graemeg-linux] lazarus - -- Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342' _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On Fri, 19 Jan 2007 14:15:34 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: On 1/19/07, Mattias Gaertner [EMAIL PROTECTED] wrote: Hope that made sense to you... :) No. Where are the lines 'CreateMissingProcBodies InsertProcBody'? It does not add any procedure, does it? Yes it created the stub in the interface section. I just got another update (r10478) and tried it again. Again it created the stub in the interface section (reverse code completion). Doing class completion to override a method still creates the wrongly formatted text though. Ok. So, can you send the output of a class completion (interface to implementation), where a wrong formatted procedure is created? Mattias Here is my latest console output: - [graemeg-linux] lazarus ./lazarus TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32 TCodeToolsOptions.AssignTo DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TCodeCompletionCodeTool.CompleteCode DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TProject.SomethingModified SessionModified TMainIDE.DoSaveProject End TMainIDE.DoCloseEditorFile A PageIndex=8 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=7 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=6 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=5 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=4 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=3 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=2 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=1 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=0 TMainIDE.DoCloseEditorFile end LAZARUS END - cleaning up ... [TMainIDE.Destroy] A [TMainIDE.Destroy] B - inherited Destroy... TMainIDE [TMainIDE.Destroy] END [graemeg-linux] lazarus - _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On Fri, 19 Jan 2007 14:44:01 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: On 1/19/07, Mattias Gaertner [EMAIL PROTECTED] wrote: On Fri, 19 Jan 2007 14:15:34 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: On 1/19/07, Mattias Gaertner [EMAIL PROTECTED] wrote: Hope that made sense to you... :) No. Where are the lines 'CreateMissingProcBodies InsertProcBody'? It does not add any procedure, does it? Yes it created the stub in the interface section. I just got another update (r10478) and tried it again. Again it created the stub in the interface section (reverse code completion). Doing class completion to override a method still creates the wrongly formatted text though. Ok. So, can you send the output of a class completion (interface to implementation), where a wrong formatted procedure is created? No, no... I have a class declaration as follows. protected procedure AssignClassProps(pSource: TtiObject); override; |press Ctrl-Space public I position the cursor at the | sign and press Ctrl-Space so I can override a method from the inherited class. I select the method I need and press Enter. ... which then gives me this protected procedure AssignClassProps(pSource: TtiObject); override; function GetCaption : string ; virtual ; public and that line function GetCaption... is formatted incorrectly compared to what I specified the the CodeTools Settings. ... If I now go further and press Ctrl-Shift-C it generates the method declaration in the Implementation section correctly formatted. As shown below. function TLearner.GetCaption: string; begin end; ... it is only the Ctrl-Space that generates the wrong formatted code. Hope that makes the problem clear. Sorry if I confused you before. Ah. This explains. What Delphi calls 'Code completion' is called under Lazarus 'Identifier completion'. And 'Code completion' under Lazarus is a bunch of features including 'Class completion'. See http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools Fixed. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On Thu, 18 Jan 2007 08:30:38 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: On 1/17/07, Mattias Gaertner [EMAIL PROTECTED] wrote: Using Code Completion (pressing Ctrl-Space) in the interface section of a class, so I can override a method, formats the code incorrectly. I have Lazarus's CodeTools Options - Space tab setup to not include any spaces in front of elements. No checkboxes are checked in the Insert space in front of groupbox. What about Insert Space after? For Insert space after I only have Colon, SemiColon and Comma checked. Does the 'preview' in the options dialog show these spaces? (Environment - CodeTools options - Spaces - Preview) The 'preview' window is correct. What in generated for Class Completion is different to the preview. Strange. I added two debugln. Please update svn and try to reproduce the bug. Then send the console output. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On 1/18/07, Mattias Gaertner [EMAIL PROTECTED] wrote: The 'preview' window is correct. What in generated for Class Completion is different to the preview. Strange. I added two debugln. Please update svn and try to reproduce the bug. Then send the console output. Here goes... I've also attached 3 images showing the CodeTools - Spaces settings with the preview, the orginal class declaration and the newly generated code. I'm running Linux x86 with GTK1. I've asked my co-worker to try on his system (WinXP) and the same thing happens. -- Console output - [graemeg-linux] lazarus ./lazarus TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32 TCodeToolsOptions.AssignTo DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TMainIDE.DoSaveAll TMainIDE.DoSaveProject End TProject.SomethingModified SessionModified TMainIDE.DoSaveProject End TMainIDE.DoCloseEditorFile A PageIndex=7 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=6 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=5 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=4 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=3 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=2 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=1 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=0 TMainIDE.DoCloseEditorFile end LAZARUS END - cleaning up ... [TMainIDE.Destroy] A [TMainIDE.Destroy] B - inherited Destroy... TMainIDE [TMainIDE.Destroy] END [graemeg-linux] lazarus -- end -- -- Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342' CodeTools_Space.png Description: PNG image generated_code.png Description: PNG image original_class_declaration.png Description: PNG image
Re: [lazarus] Code completion formatted code incorrectly
On Thu, 18 Jan 2007 14:52:54 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: On 1/18/07, Mattias Gaertner [EMAIL PROTECTED] wrote: The 'preview' window is correct. What in generated for Class Completion is different to the preview. Strange. I added two debugln. Please update svn and try to reproduce the bug. Then send the console output. Here goes... I've also attached 3 images showing the CodeTools - Spaces settings with the preview, the orginal class declaration and the newly generated code. I'm running Linux x86 with GTK1. I've asked my co-worker to try on his system (WinXP) and the same thing happens. -- Console output - [graemeg-linux] lazarus ./lazarus TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32 TCodeToolsOptions.AssignTo DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] Looking good. [...] ... [TMainIDE.Destroy] A [TMainIDE.Destroy] B - inherited Destroy... TMainIDE [TMainIDE.Destroy] END [graemeg-linux] lazarus Sorry, I forgot: Can you do a reverse class completion? http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools#Reversed_Class_Completion Then you should see: TCodeCompletionCodeTool.ApplyClassCompletion DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On Thu, 18 Jan 2007 16:05:35 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: On 1/18/07, Mattias Gaertner [EMAIL PROTECTED] wrote: Sorry, I forgot: Can you do a reverse class completion? http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools#Reversed_Class_Completion Then you should see: TCodeCompletionCodeTool.ApplyClassCompletion DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] It seem to be happy with that... The code generated in the interface section was formatted correctly. - Console output -- [graemeg-linux] lazarus ./lazarus TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32 TCodeToolsOptions.AssignTo DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TCodeCompletionCodeTool.ApplyClassCompletion DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TMainIDE.DoSaveAll TMainIDE.DoSaveProject End TProject.SomethingModified SessionModified TMainIDE.DoSaveProject End TMainIDE.DoCloseEditorFile A PageIndex=7 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=6 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=5 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=4 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=3 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=2 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=1 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=0 TMainIDE.DoCloseEditorFile end LAZARUS END - cleaning up ... [TMainIDE.Destroy] A [TMainIDE.Destroy] B - inherited Destroy... TMainIDE [TMainIDE.Destroy] END [graemeg-linux] lazarus - END This is what I typed in the 'implementation' section... function TLearner.DoSomething(AParam1: string): integer; begin end; and this is what it generated in the 'interface' section... function DoSomething(AParam1: string): integer; Looking good. Now what? :-) So, the bug is somewhere in the normal class completion. I added some more verbosity. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On 1/18/07, Mattias Gaertner [EMAIL PROTECTED] wrote: So, the bug is somewhere in the normal class completion. I added some more verbosity. I did the same reverse class completion test as before. Here is the console output. --- [graemeg-linux] lazarus ./lazarus TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32 TCodeToolsOptions.AssignTo DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TCodeCompletionCodeTool.CompleteCode DoInsertSpaceInFront=[] DoInsertSpaceAfter=[Colon,Semicolon,Comma] TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=procedure TLearner.Save; begin inherited Save; end; TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=function TLearner.IsValid(const AErrors:TtiObjectErrors):boolean; begin Result:=inherited IsValid(AErrors); end; TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=destructor TLearner.Destroy; begin inherited Destroy; end; TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=constructor TLearner.Create; begin inherited Create; end; TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode=procedure TLearner.AssignClassProps(pSource:TtiObject); begin inherited AssignClassProps(pSource); end; TMainIDE.DoSaveAll TMainIDE.DoSaveProject End TProject.SomethingModified SessionModified TMainIDE.DoSaveProject End TMainIDE.DoCloseEditorFile A PageIndex=7 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=6 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=5 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=4 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=3 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=2 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=1 TMainIDE.DoCloseEditorFile end TMainIDE.DoCloseEditorFile A PageIndex=0 TMainIDE.DoCloseEditorFile end LAZARUS END - cleaning up ... [TMainIDE.Destroy] A [TMainIDE.Destroy] B - inherited Destroy... TMainIDE [TMainIDE.Destroy] END [graemeg-linux] lazarus --- Hope that made sense to you... :) -- Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342' _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On Wed, 17 Jan 2007 10:11:23 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: Hi, Using Code Completion (pressing Ctrl-Space) in the interface section of a class, so I can override a method, formats the code incorrectly. I have Lazarus's CodeTools Options - Space tab setup to not include any spaces in front of elements. No checkboxes are checked in the Insert space in front of groupbox. What about Insert Space after? Problem #1: This is how the original class has it's method defined. Notice that there is no spaces in front of the colons and semi-colons. public functionIsValid(const AErrors: TtiObjectErrors): boolean; overload; virtual; And this is how code completion inserts that method into a new class where I am trying to override the method. Notice the formatting is different, it has spaces in front of the identifiers, colons and semi-colons. public function IsValid ( const AErrors : TtiObjectErrors ) : boolean ; overload ; virtual ; Does the 'preview' in the options dialog show these spaces? (Environment - CodeTools options - Spaces - Preview) Problem #2: Another problems, is that it doesn't put the 'override' keyword at the end! This is not yet implemented. Problem #3: This is more a nice-to-have feature. When I use the code completion in the new class as show above, it inserts the code at the cursor location, even if I am in the private or protected section of the class. I think it could be more intelligent and know that the overridden method must go into the same section as it was originally defined, in this case the public section. Yes. At the moment 'class completion' does not search/read the ancestor class, so it can't know. Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Code completion formatted code incorrectly
On 1/17/07, Mattias Gaertner [EMAIL PROTECTED] wrote: Using Code Completion (pressing Ctrl-Space) in the interface section of a class, so I can override a method, formats the code incorrectly. I have Lazarus's CodeTools Options - Space tab setup to not include any spaces in front of elements. No checkboxes are checked in the Insert space in front of groupbox. What about Insert Space after? For Insert space after I only have Colon, SemiColon and Comma checked. Does the 'preview' in the options dialog show these spaces? (Environment - CodeTools options - Spaces - Preview) The 'preview' window is correct. What in generated for Class Completion is different to the preview. Problem #2: Another problems, is that it doesn't put the 'override' keyword at the end! This is not yet implemented. No problem. Yes. At the moment 'class completion' does not search/read the ancestor class, so it can't know. Thanks for the info... I'll had the last two as feature requests to Mantis -- Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342' _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives