[Lazarus] Format code on Save

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Jan 25 15:15:10 CET 2017


On Wed, 25 Jan 2017 13:25:56 +0000
Graeme Geldenhuys via Lazarus <lazarus at lists.lazarus-ide.org> 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 needed instead? Does JCF format code
> directly from memory (SynEdit's buffer), or does it read and format a
> file from disk. If the latter, then I guess a "after save" event would
> indeed be helpful.

I just took a quick look at the JCF plugin source: It works
on the current source editor and uses ReplaceLines, so it keeps all
marks and adds one undo step. Nice.

An 'after save' could be added, but that would mean save, execute jcf,
load - loosing the undo stack and possibly moving marks.

 
>[...]

Mattias



More information about the Lazarus mailing list