Re: [Lazarus] Code Completion Templates
On Mon, 11 Feb 2013 21:43:03 -0500 Donald Ziesig don...@ziesig.org wrote: [...] Hmmm. In my code, the XML reader detects, and the IDE writes XML errors to stdout as you say. I haven't implemented a GUI to generate the XML. (Yet). Right now, if the author of the XML makes an error, he had better be watching stdout while the XML loads so he can catch the errors. I will catch the syntax errors with a handler that puts up a message box for now to make them visible to the user. I want to get the snippet generation fully implemented and tested first (it is almost done) before I get fancy with a GUI. Any suggestions will be appreciated. There are already several frames about options for codetools. Extend an existing one or add a new one. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On 02/12/2013 03:36 AM, Mattias Gaertner wrote: On Mon, 11 Feb 2013 21:43:03 -0500 Donald Ziesig don...@ziesig.org wrote: [...] Hmmm. In my code, the XML reader detects, and the IDE writes XML errors to stdout as you say. I haven't implemented a GUI to generate the XML. (Yet). Right now, if the author of the XML makes an error, he had better be watching stdout while the XML loads so he can catch the errors. I will catch the syntax errors with a handler that puts up a message box for now to make them visible to the user. I want to get the snippet generation fully implemented and tested first (it is almost done) before I get fancy with a GUI. Any suggestions will be appreciated. There are already several frames about options for codetools. Extend an existing one or add a new one. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus I extended the TCodetoolsClassCompletionOptionsFrame and added the template expander data in TCodeToolsOptions. I can see the data being saved and restored appropriately in codetoolsoptions.xml. I have spent the whole morning trying to find the route I must use to get the data in TCodeToolsOptions (which now contains the path to the template file) into my TemplateExpander unit (which is in the uses clause of codecompletiontool.pas). The following code from my TemplateExpander unit fails at compilation: uses CodeToolOptions; because the compiler can't find the file. What do I need to do to make that unit visible in my code? It seems to have something to do with packages, but after reading the docs, I still don't know where to look. Thanks, Don Ziesig -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On 12/02/13 6:58, Donald Ziesig wrote: The following code from my TemplateExpander unit fails at compilation: uses CodeToolOptions; because the compiler can't find the file. Assuming CodeTools has been added as a dependency for your project, I think you also need to add in the Project Options dialog in the Compiler Options | Paths page, in the dropdown field labelled Other unit files(-Fu) (delimiter is semicolon) the following macro $(LazarusDir)\units\$(TargetCPU)-$(TargetOS)\$(LCLWidgetType) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On Tue, 12 Feb 2013 13:58:15 -0500 Donald Ziesig don...@ziesig.org wrote: On 02/12/2013 03:36 AM, Mattias Gaertner wrote: [...] I extended the TCodetoolsClassCompletionOptionsFrame and added the template expander data in TCodeToolsOptions. I can see the data being saved and restored appropriately in codetoolsoptions.xml. I have spent the whole morning trying to find the route I must use to get the data in TCodeToolsOptions (which now contains the path to the template file) into my TemplateExpander unit (which is in the uses clause of codecompletiontool.pas). The following code from my TemplateExpander unit fails at compilation: uses CodeToolOptions; because the compiler can't find the file. That is a unit of the IDE itself. It can not be accessed by installed packages. I think these new options can be added to the IDE. They don't need an extra package. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On 11.02.2013 02:45, Donald Ziesig wrote: 2) What is the preferred way to submit the patch? (In my previous life, before retirement, all I had to do was submit my code to the Quality Control unit and wait for their inevitable nasty-grams; the classic of which was What is this thing called a 'state machine' you have in your code? ;-) ). Attach it to the bug report I mentioned above (and maybe write a comment explaining your patch). The inevitable nasty-grams will then follow as well :P Regard, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On Sun, 10 Feb 2013 20:45:49 -0500 Donald Ziesig don...@ziesig.org wrote: [...] I have almost finished a patch that uses an xml file, a new unit and mods to codecompletion.pas to implement configurable code completion. I have a few questions remaining: 1) What is the preferred way to specify the name and location of the xml file? I spent several hours trying to access PrimaryConfigPath or SecondaryConfigPath from my unit which is in the codetools package. Right now I am testing with a hard-coded path/file name. You can add those options to the existing options. See ide/codetoolsoptions.pas 2) What is the preferred way to submit the patch? (In my previous life, before retirement, all I had to do was submit my code to the Quality Control unit and wait for their inevitable nasty-grams; the classic of which was What is this thing called a 'state machine' you have in your code? ;-) ). Attach it to http://bugs.freepascal.org/view.php?id=15922 3) I have a separate program to parse the xml file and detect any possible syntax errors before Lazarus tries to load it. Where should I put that? What kind of syntax errors? For the xml or for the pascal snippets? Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On 02/11/2013 03:46 AM, Mattias Gaertner wrote: On Sun, 10 Feb 2013 20:45:49 -0500 Donald Ziesig don...@ziesig.org wrote: [...] I have almost finished a patch that uses an xml file, a new unit and mods to codecompletion.pas to implement configurable code completion. I have a few questions remaining: 1) What is the preferred way to specify the name and location of the xml file? I spent several hours trying to access PrimaryConfigPath or SecondaryConfigPath from my unit which is in the codetools package. Right now I am testing with a hard-coded path/file name. You can add those options to the existing options. See ide/codetoolsoptions.pas 2) What is the preferred way to submit the patch? (In my previous life, before retirement, all I had to do was submit my code to the Quality Control unit and wait for their inevitable nasty-grams; the classic of which was What is this thing called a 'state machine' you have in your code? ;-) ). Attach it to http://bugs.freepascal.org/view.php?id=15922 3) I have a separate program to parse the xml file and detect any possible syntax errors before Lazarus tries to load it. Where should I put that? What kind of syntax errors? For the xml or for the pascal snippets? For the xml. I'm leaving the pascal as an exercise for the student ;-) . Don -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On Mon, 11 Feb 2013 15:50:47 -0500 Donald Ziesig don...@ziesig.org wrote: [...] 3) I have a separate program to parse the xml file and detect any possible syntax errors before Lazarus tries to load it. Where should I put that? What kind of syntax errors? For the xml or for the pascal snippets? For the xml. I'm leaving the pascal as an exercise for the student ;-) . The xml is parsed by the xml reader. It has error messages for syntax errors. The IDE writes them only to stdout. This was never a problem, because the xml file is written by the IDE, so there are no syntax errors. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On 02/11/2013 03:57 PM, Mattias Gaertner wrote: On Mon, 11 Feb 2013 15:50:47 -0500 Donald Ziesig don...@ziesig.org wrote: [...] 3) I have a separate program to parse the xml file and detect any possible syntax errors before Lazarus tries to load it. Where should I put that? What kind of syntax errors? For the xml or for the pascal snippets? For the xml. I'm leaving the pascal as an exercise for the student ;-) . The xml is parsed by the xml reader. It has error messages for syntax errors. The IDE writes them only to stdout. This was never a problem, because the xml file is written by the IDE, so there are no syntax errors. Hmmm. In my code, the XML reader detects, and the IDE writes XML errors to stdout as you say. I haven't implemented a GUI to generate the XML. (Yet). Right now, if the author of the XML makes an error, he had better be watching stdout while the XML loads so he can catch the errors. I will catch the syntax errors with a handler that puts up a message box for now to make them visible to the user. I want to get the snippet generation fully implemented and tested first (it is almost done) before I get fancy with a GUI. Any suggestions will be appreciated. Thanks, Don -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On 02/05/2013 02:42 PM, Sven Barth wrote: On 05.02.2013 18:30, Mattias Gaertner wrote: Donald Ziesig don...@ziesig.org hat am 5. Februar 2013 um 23:16 geschrieben: Hi All! Could anyone point me at the file(s) containing the templates invoked with Ctrl-Shift-C? Specifically I would like to replace the SetParam code that expands to: if(AValue=fParam) then exit; fParam=AValue; with Update(fParam,AValue); // Keeps track of modifications to the underlying object. It's hard coded. See components/codetools/codecompletion.pas around line 6730. You can create a feature request or a patch to make this configurable. This has already been reported by me nearly three years ago: http://bugs.freepascal.org/view.php?id=15922 Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus Hi Again, I have almost finished a patch that uses an xml file, a new unit and mods to codecompletion.pas to implement configurable code completion. I have a few questions remaining: 1) What is the preferred way to specify the name and location of the xml file? I spent several hours trying to access PrimaryConfigPath or SecondaryConfigPath from my unit which is in the codetools package. Right now I am testing with a hard-coded path/file name. 2) What is the preferred way to submit the patch? (In my previous life, before retirement, all I had to do was submit my code to the Quality Control unit and wait for their inevitable nasty-grams; the classic of which was What is this thing called a 'state machine' you have in your code? ;-) ). 3) I have a separate program to parse the xml file and detect any possible syntax errors before Lazarus tries to load it. Where should I put that? Thanks, Don Ziesig -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Code Completion Templates
Hi All! Could anyone point me at the file(s) containing the templates invoked with Ctrl-Shift-C? Specifically I would like to replace the SetParam code that expands to: if(AValue=fParam) then exit; fParam=AValue; with Update(fParam,AValue); // Keeps track of modifications to the underlying object. Thanks, Don Ziesig -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
Donald Ziesig don...@ziesig.org hat am 5. Februar 2013 um 23:16 geschrieben: Hi All! Could anyone point me at the file(s) containing the templates invoked with Ctrl-Shift-C? Specifically I would like to replace the SetParam code that expands to: if(AValue=fParam) then exit; fParam=AValue; with Update(fParam,AValue); // Keeps track of modifications to the underlying object. It's hard coded. See components/codetools/codecompletion.pas around line 6730. You can create a feature request or a patch to make this configurable. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On 05.02.2013 18:30, Mattias Gaertner wrote: Donald Ziesig don...@ziesig.org hat am 5. Februar 2013 um 23:16 geschrieben: Hi All! Could anyone point me at the file(s) containing the templates invoked with Ctrl-Shift-C? Specifically I would like to replace the SetParam code that expands to: if(AValue=fParam) then exit; fParam=AValue; with Update(fParam,AValue); // Keeps track of modifications to the underlying object. It's hard coded. See components/codetools/codecompletion.pas around line 6730. You can create a feature request or a patch to make this configurable. This has already been reported by me nearly three years ago: http://bugs.freepascal.org/view.php?id=15922 Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Completion Templates
On 05/02/2013 19:42, Sven Barth wrote: On 05.02.2013 18:30, Mattias Gaertner wrote: Donald Ziesig don...@ziesig.org hat am 5. Februar 2013 um 23:16 geschrieben: Could anyone point me at the file(s) containing the templates invoked with Ctrl-Shift-C? ... It's hard coded. See components/codetools/codecompletion.pas around line 6730. This has already been reported by me nearly three years ago: http://bugs.freepascal.org/view.php?id=15922 You can always create a macro (Lazarus 1.1 trunk) http://wiki.lazarus.freepascal.org/Editor_Macros_PascalScript begin ecCompleteCode; // check for if AValu ..., in case completion did fail // edit/replace text at caret end; and assign it to a key of your choice -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus