[Lazarus] Ideas for improving lazarus.dci code templates

Mattias Gärtner nc-gaertnma at netcologne.de
Wed May 13 15:34:46 CEST 2009

Zitat von Graeme Geldenhuys <graemeg.lists at gmail.com>:

> Hi,
> Over the years I have noticed some shortcomings in the lazarus.dci
> handling. Here are some of my ideas. Please comment on them before I
> create official feature requests in Mantis.
> *  Lazarus should have seperate .dci files. One for "custom user
> settings" and one which contains the "default" .dci settings. That way
> if new default settings get applied to the lazarus.dci file, all users
> get it without the next Lazarus update. The lazarus.dci should live in
> the Lazarus install directory. Then we should have a user.dci in the
> profile directory.
> * If the user customizes an existing (default) code templates, they
> should be added to the user.dci file and override the default one.

+1 for overriding.

About the default file:
The defaults are compiled into the IDE.
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.
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.

Why not use the same as for the highlighters and key mappings:
The IDE first loads the defaults, then merges the user config  
(additions, replacements).
Because you can not delete a default code template, a 'disable' option  
is needed.

> * This design which be extended even further to have language specific
> .dci files. Instead of lazarus.dci, rather have the following:
>    - objectpascal.dci
>    - java.dci
>    - html.dci
>    - javascript.dci
>    etc...
>   So as the IDE opens a file, lets say for example a "index.html"
> file, then the default code template for that file will be html.dci
>   The "synedit" editor available on sourceforge already includes a lot
> of language specific dci files. I post those to mantis if needed.

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

>  * Why doesn't the default lazarus.dci contain a "repeat...until' code
> template. I always add it myself though.

The templates use the first unique prefix, so 're' will automatically work.

>  * Maybe project specific code templates could also be an option. I'm
> not sure is this is really relevant, but it might be handy. For
> example, I develop many tiOPF (Object Persistent Framework)
> applications. I have a lot of code templates for such projects. But if
> I work on a quick console application, those code templates are not
> needed. Some maybe Lazarus Packages or Project Options could contain
> an entry for project or packages specific code templates. Project
> Options is probably the better option.

IMO this is only useful for power power users.

> Your thought?  Any new suggestions?


Powered by NetMail

More information about the Lazarus mailing list