Re: [Lazarus] Format code on Save

2017-02-23 Thread Graeme Geldenhuys via Lazarus
On 2017-02-23 09:08, Mattias Gaertner via Lazarus wrote: >> Also, what does the AddHandlerOnSaveEditorFile()'s "AtLast" parameter >> mean and do? > > Prepend or append to the list of handlers. Ah, thank. That would come in handy if the IDE Options ever have a GUI to manage such actions. eg:

Re: [Lazarus] Format code on Save

2017-02-23 Thread Mattias Gaertner via Lazarus
On Thu, 23 Feb 2017 08:41:06 + Graeme Geldenhuys via Lazarus wrote: >[...] > > Check parameter SaveStep. > > I tried both sefsBeforeWrite and sefsAfterWrite - it made no difference > to the issue of the method being called twice. > > Also, what does the

Re: [Lazarus] Format code on Save

2017-02-23 Thread Mattias Gaertner via Lazarus
On Thu, 23 Feb 2017 00:40:13 + Graeme Geldenhuys via Lazarus wrote: > On 2017-01-27 14:37, Mattias Gaertner via Lazarus wrote: >[...] > > LazarusIDE.AddHandlerOnSaveEditorFile(@YourEvent); > > > A bit late, but thank you for adding that functionality. I've

Re: [Lazarus] Format code on Save

2017-02-22 Thread Graeme Geldenhuys via Lazarus
On 2017-01-27 14:37, Mattias Gaertner via Lazarus wrote: > I added the event. > > uses LazIDEIntf > > LazarusIDE.AddHandlerOnSaveEditorFile(@YourEvent); A bit late, but thank you for adding that functionality. I've now managed to create my IDE add-on and it works. But I noticed that with

Re: [Lazarus] Format code on Save

2017-01-25 Thread Graeme Geldenhuys via Lazarus
On 2017-01-25 14:15, Mattias Gaertner via Lazarus wrote: > on the current source editor and uses ReplaceLines, so it keeps all > marks and adds one undo step. Nice. That is much better indeed. So a 'before save' would then be the useful one. > An 'after save' could be added, but that would mean

Re: [Lazarus] Format code on Save

2017-01-25 Thread Mattias Gaertner via Lazarus
On Wed, 25 Jan 2017 13:25:56 + Graeme Geldenhuys via Lazarus wrote: > On 2017-01-25 13:15, Mattias Gaertner via Lazarus wrote: > > I can add an event called before saving a source editor file. > > Would that help you? > > I think a "after save" event is

Re: [Lazarus] Format code on Save

2017-01-25 Thread Graeme Geldenhuys via Lazarus
On 2017-01-25 13:15, Mattias Gaertner via Lazarus wrote: > I can add an event called before saving a source editor file. > Would that help you? I think a "after save" event is needed instead? Does JCF format code directly from memory (SynEdit's buffer), or does it read and format a file from

Re: [Lazarus] Format code on Save

2017-01-25 Thread Mattias Gaertner via Lazarus
On Wed, 25 Jan 2017 11:28:21 + Graeme Geldenhuys via Lazarus wrote: > Hi, > > As the subject lines says. If you set up the Jedi Code Formatting > options, is there a way to tell Lazarus to automatically format the unit > when you Ctrl+S (Save)? Eclipse IDE