Graeme's recent post made me wonder if there is been work or talk of work on implementing Live Templates like Delphi has?
I imagine that that kind of behavior is a bit of work to implement.

Mailing lists / lazarus / 2009-05
8 messages · 5 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Graeme's recent post made me wonder if there is been work or talk of work on implementing Live Templates like Delphi has?
I imagine that that kind of behavior is a bit of work to implement.
Zitat von Lee Jenkins :
Graeme's recent post made me wonder if there is been work or talk of work on implementing Live Templates like Delphi has?
Yes.
1. Lazarus will not support the Delphi syntax, because Lazarus already supports code macros. There are already some code macros using the codetools.
2. auto complete without pressing a short cut already works for return, space and word end.
Some code macros are needed to fine tune adding text if parts of the template already exists (for example auto complete 'begin' after pressing return). But this is stuff for another thread.
3. templates with parameters: editing the parameters directly in the source editor (synedit) without a dialog. synedit needs a further edit mode for marking and editing several places in parallel. Martin has already implemented marking several places. I guess he can also create a plugin/extension/mechanism for the needed edit mode. When this is done, I will be glad to implement the rest.
This edit mode is also needed for in situ rename.
I imagine that that kind of behavior is a bit of work to implement.
Yes, but I bet Martin has already some ideas for synedit.
Mattias
Yep, it's on the list, but not yet sure when.
For code Template there a 2 main targets:
1) "Form mode"
- The code template defines several places (form-fields) where input is needed "for [] := [] to [] do"
- the Editor the allows to navigate them using tab (or a user defined key shortcut
2) Sync Edit
Actually this is a feature off it's own, but should work specially with templates: the form-fields from above could be linked, editing the content off 1, would update the other too.
Example: check a variable is in range: (while you type in field 1, the same appears in field 2:
"if ([] >= 10) and ([] < 20) then "
Not exactly related to templates, but one feature, I like to add for myself.
Motivated by commenting code.
If you type "(*", this will comment all of the remaining code, temporarily disabling all highlighting, and unfolding everything.....
A magic "add cloisng bracket".
If you type "(*" SynEdit inserts a >virtual< "*)". (Could be shown like a hint...) the closing "*)" follow sthe caret movement. So you can move the caret to the desired location and hit enter. It could be cancelled bey "esc", it would also detect manually typing the "*)" sequence....
It could work for any other pair-construct, including begin/end
Zitat von Lee Jenkins : Yes. 1. Lazarus will not support the Delphi syntax, because…
2009/5/13 Mattias G?rtner :
2. auto complete without pressing a short cut already works for return, space and word end.
And boy do those come in handy! I already have my own collection of marco code templates. Some even create complete classes using text in the clipboard. :-)
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Graeme's recent post made me wonder if there is been work or talk of work on implementing…
Graeme's recent post made me wonder if there is been work or talk of work on implementing Live Templates like Delphi has?
My experience with Live Templates: they are nice to use, but so hard to write properly, that no user will ever try to write a template himself.
Then it does not make a difference, whether the templates are implemented in code (codetools), or as scripts.
DoDi
Hans-Peter Diettrich wroteMy experience with Live Templates: they are nice to use, but so hard to write properly, that no user will ever try to write a template himself.
I don't know about that. The tiOPF has quite a few Live Templates for Delphi's newer IDEs. All contributed by tiOPF users. I once found a tutorial on live templates and they explain how to write them. It looked rather self explanatory if you know the syntax.
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Graeme's recent post made me wonder if there is been work or talk of work on implementing…
Great news everyone. Kudos. I look forward to seeing the new stuff.
On Wed, May 13, 2009 at 7:54 PM, Hans-Peter Diettrich I don't know about that. The tiOPF…
They are invaluable in using tiOPF and other frameworks where you're doing a lot of inheritance and overriding methods. I have a couple live templates that create whole units which saves a lot of time.