Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-05

Ideas for improving lazarus.dci code templates

8 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

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.

* 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.

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

* 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.

Your thought? Any new suggestions?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys
Graeme Geldenhuys wrote 8 lines
* 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...

The "synedit" editor contains the following language specific .dci files.

html.dci
java.dci
js.dci
MS-DOS Batch.dci
pascal.dci
R.dci
tex.dci
vbs.dci

I would find the HTML, JavaScript, Object Pascal and TeX code templates very handy. I often edit such files in Lazarus IDE.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys: Over the years I have noticed some shortcomings in the lazarus.dci handling. Here are…

I can only agree with all Graeme's remarks, except the last, which I think is a bit overkill.

Michael.

Graeme Geldenhuys wrote 56 lines
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. * 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. * Why doesn't the default lazarus.dci contain a "repeat...until' code template. I always add it myself though. * 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. Your thought? Any new suggestions? Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gärtner
to Graeme Geldenhuys: Over the years I have noticed some shortcomings in the lazarus.dci handling. Here are…

Zitat von Graeme Geldenhuys :

Show quoted text 15 lines
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.

Show quoted text 11 lines
* 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.

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

Show quoted text 8 lines
* 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?

Mattias

Powered by NetMail

Reply by email

Graeme Geldenhuys
to Mattias Gärtner

2009/5/13 Mattias G?rtner :

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.

Show quoted text 6 lines
> ?* 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 ]
repeat

until |;
==================
IMO this is only useful for power power users.

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

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Mattias Gärtner: Zitat von Graeme Geldenhuys : +1 for overriding. About the default file: The defaults are…

2009/5/13 Mattias G?rtner :

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

I've added some code templates for 8 languages. Obviously these could be improved on over time. New templates like FPDoc XML could also be quite handy. Even though Lazarus integrated doc editor does a pretty good job already, it still misses some features which could be manually edited in the IDE.

http://bugs.freepascal.org/view.php?id=13701

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Mattias Gaertner
to Graeme Geldenhuys: 2009/5/13 Mattias G?rtner : I know, but that is part of the problem. And it shouldn't be…
Show quoted text 14 lines
2009/5/13 Mattias G?rtner : > > 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.

Yes, lazarus.dci is an exception and should be changed to follow the other settings - defaults will not be written to disk.

Show quoted text 7 lines
> 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).

For example the windows installer sets the fpc search path. The linux packages and OS X packages use the secondaries too.

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.

When the IDE starts it writes the primary and secondary config directory to stdout.

Show quoted text 18 lines
> 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.

The internals are little bit more complicated but from users pov you are right.

Mattias

Reply by email