[Lazarus] Ideas for improving lazarus.dci code templates

Graeme Geldenhuys graemeg.lists at gmail.com
Wed May 13 16:31:04 CEST 2009

2009/5/13 Mattias Gärtner <nc-gaertnma at netcologne.de>:
> About the default file:
> The defaults are compiled into the IDE.

I know, but that is part of the problem. And it shouldn't be compiled
into the IDE. At the moment as soon as you start the IDE for the first
time, those defaults are written the users profile directory and into
a file called lazarus.dci.  Now if the next version of the IDE has new
defaults, the users lazarus.dci is not updated. Defaults should not be
copied to the users profile directory, they should live in a
objectpascal.dci file in the Lazarus install directory. This also
makes it easier to for contributors to find the code templates and
email patches for updates.

> The IDE has a 'secondary' config path, where pool admins and package
> maintainers can put default configs. A secondary config file is copied
> to the user's config directory, iff no user config exists. i.e. the
> configs are not merged.

I get the idea, but I have never seen this in real life (as far as I
know). What is the name of the secondary user config file?  I always
only have the one lazarus.dci file in my ~/.lazarus/ directory. I have
searched my $HOME/.lazarus/ directory and I only have one .dci file.

> If no primary and no secondary config exists, the IDE uses its defaults.
> So there is already a chain of defaults.
> I think adding a further default file only complicates things and will
> not solve much.

Maybe I misunderstood your comment about secondary config files and
that it relates more that just to .dci files.

I'm thinking in line of something like Project Templates - a directory
with default code templates that the IDE reads. You have the "default"
template .dci files for various languages (html.dci, objectpascal.dci,
etc..). If the user did not create any custom code templates, no .dci
files are in the lazarus profile directory (~/.lazarus) as it only
uses the ones in the Lazarus install directory. That way if you add
new code templates like your latest one ('ofall' enum template), you
simply need to patch the objectpascal.dci file and on the next update,
everybody will have it. The lazarus profile directory should just
store custom user created code templates.

> Ok. Add an extra .dci for all languages (copyright templates, todo
> comments, ...).

OK, I'll submit the new language specific .dci files to Mantis in a minute.

>>  * Why doesn't the default lazarus.dci contain a "repeat...until' code
>> template. I always add it myself though.
> Name?
> rep?
> The templates use the first unique prefix, so 're' will automatically work.

I have this in my lazarus.dci file.

[repeat | Repeat until ]

until |;

> IMO this is only useful for power power users.

OK, then lets forget about that last point.  :)

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the Lazarus mailing list