Re: [lazarus] Lazarus keyword completion addon

2007-05-23 Thread Marc Weustink

Andrew Haines wrote:

That would be very, very nice to have: Case Correction.  I know that its
not integral, but I am a stickler for case consistency and a feature
like that would help me save time by not having to hit shift so much.
Case correction is also help to avoid spelling mistake for identifiers
since when you hit space, it corrects and you know its correct.



memory lane
I remember using qbasic a long time ago and when you typed a var name it
would change the var's case everywhere to what you just typed. /memory
lane


VB had (has?) this feature also, pretty annoying.

Marc

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Mattias Gaertner
On Tue, 22 May 2007 09:53:07 +0200
Graeme Geldenhuys [EMAIL PROTECTED] wrote:

 Hi,
 
 I want to try and implement that feature mentioned in the New since
 Delphi 7... article.
 
 When you type 'begin' and press enter, the editor automatically
 inserts the blank line and the closing 'end;' keyword. Also it will
 use the correct indentation.
 
 Now I have never done Code Generation with CodeTools, so might need
 some hints... I gather CodeTools has the capability for something like
 this? 

For simple things like begin/end, class/end we don't need the
codetools, but simple text code templates. For more complex tasks you
can use macro functions, which can trigger anything including the
codetools. See for example $ProcName().


 I know it must can via Ctrl+J, but can the keyword completion
 be triggered automatically?

Not yet. But this is easy to implement. 
The above examples (being/end) are triggered by pressing 'return'.
Of course not all templates should be triggered by pressing 'return',
so every template need an own set of triggers.
What about other triggers? For example space, tab, semicolon, ...


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Paul Ishenin

Mattias Gaertner wrote:

On Tue, 22 May 2007 09:53:07 +0200
Graeme Geldenhuys [EMAIL PROTECTED] wrote:


Hi,

I want to try and implement that feature mentioned in the New since
Delphi 7... article.

When you type 'begin' and press enter, the editor automatically
inserts the blank line and the closing 'end;' keyword. Also it will
use the correct indentation.

Now I have never done Code Generation with CodeTools, so might need
some hints... I gather CodeTools has the capability for something like
this? 


For simple things like begin/end, class/end we don't need the
codetools, but simple text code templates. For more complex tasks you
can use macro functions, which can trigger anything including the
codetools. See for example $ProcName().



I know it must can via Ctrl+J, but can the keyword completion
be triggered automatically?


Not yet. But this is easy to implement. 
The above examples (being/end) are triggered by pressing 'return'.

Of course not all templates should be triggered by pressing 'return',
so every template need an own set of triggers.
What about other triggers? For example space, tab, semicolon, ...


Maybe better to look how delphi store this templates and if possible to 
use that template file. There I think we can find what actions can 
trigger template insertion.


Best regards,
Paul Ishenin.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Graeme Geldenhuys

On 5/22/07, Mattias Gaertner [EMAIL PROTECTED] wrote:

Not yet. But this is easy to implement.
The above examples (being/end) are triggered by pressing 'return'.
Of course not all templates should be triggered by pressing 'return',
so every template need an own set of triggers.
What about other triggers? For example space, tab, semicolon, ...


'Space' must definitely be a trigger as well (in the future).
Especially if we want to implement 'auto spellcheck' and 'auto fixing
of case for variables and identifiers' in the IDE.


--
Graeme Geldenhuys

General error, hit any user to continue.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Graeme Geldenhuys

On 5/22/07, Paul Ishenin [EMAIL PROTECTED] wrote:


Maybe better to look how delphi store this templates and if possible to
use that template file. There I think we can find what actions can
trigger template insertion.



From the brief look at the new Delphi templates (xml files), those

templates do define what key combination triggers insertion, even the
location of the cursor has an affect (example: some templates can only
be triggered inside a procedure, others only in the interface section
of a unit) etc..  I've seen some pretty cool custom templates designed
by the community.


--
Graeme Geldenhuys

General error, hit any user to continue.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Mattias Gaertner
On Tue, 22 May 2007 16:56:00 +0800
Paul Ishenin [EMAIL PROTECTED] wrote:

 Mattias Gaertner wrote:
  On Tue, 22 May 2007 09:53:07 +0200
  Graeme Geldenhuys [EMAIL PROTECTED] wrote:
  
  Hi,
 
  I want to try and implement that feature mentioned in the New
  since Delphi 7... article.
 
  When you type 'begin' and press enter, the editor automatically
  inserts the blank line and the closing 'end;' keyword. Also it will
  use the correct indentation.
 
  Now I have never done Code Generation with CodeTools, so might need
  some hints... I gather CodeTools has the capability for something
  like this? 
  
  For simple things like begin/end, class/end we don't need the
  codetools, but simple text code templates. For more complex tasks
  you can use macro functions, which can trigger anything including
  the codetools. See for example $ProcName().
  
  
  I know it must can via Ctrl+J, but can the keyword completion
  be triggered automatically?
  
  Not yet. But this is easy to implement. 
  The above examples (being/end) are triggered by pressing 'return'.
  Of course not all templates should be triggered by pressing
  'return', so every template need an own set of triggers.
  What about other triggers? For example space, tab, semicolon, ...
 
 Maybe better to look how delphi store this templates and if possible
 to use that template file. There I think we can find what actions can 
 trigger template insertion.

I only took a short look at some examples, and it seems they invented a
xml format with lots of Delphi IDE specific things. If lazarus tries to
support that, then it needs to add a lot of workarounds and it needs to
add somehow its own functions. IMHO it will be easier to convert the
Delphi templates, then to support the xml format.
Of course we can switch from the current dci text format to some xml
format.


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Mattias Gaertner
On Tue, 22 May 2007 11:07:57 +0200
Graeme Geldenhuys [EMAIL PROTECTED] wrote:

 On 5/22/07, Paul Ishenin [EMAIL PROTECTED] wrote:
 
  Maybe better to look how delphi store this templates and if
  possible to use that template file. There I think we can find what
  actions can trigger template insertion.
 
 From the brief look at the new Delphi templates (xml files), those
 templates do define what key combination triggers insertion, even the
 location of the cursor has an affect (example: some templates can only
 be triggered inside a procedure, others only in the interface section
 of a unit) etc..  I've seen some pretty cool custom templates designed
 by the community.

Can you give examples?


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Graeme Geldenhuys

On 5/22/07, Mattias Gaertner [EMAIL PROTECTED] wrote:

I only took a short look at some examples, and it seems they invented a
xml format with lots of Delphi IDE specific things. If lazarus tries to
support that, then it needs to add a lot of workarounds and it needs to
add somehow its own functions. IMHO it will be easier to convert the
Delphi templates, then to support the xml format.


I agree with you here Mattias.  The Delphi template xml format is very
easy to read (visually) and understand, so should be a simple process
to convert/rewrite that manually for the Lazarus IDE in whatever xml
format we define.
I don't think it's needed for Lazarus to actually read the Delphi xml format.


--
Graeme Geldenhuys

General error, hit any user to continue.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Graeme Geldenhuys

On 5/22/07, Mattias Gaertner [EMAIL PROTECTED] wrote:

 of a unit) etc..  I've seen some pretty cool custom templates designed
 by the community.

Can you give examples?


Sure, here is a few from the tiOPF project.

BTW: For technical details about the xml format have a look at:
 http://delphi.wikia.com/wiki/Live_Templates_Technical_Info


This one can only be triggered in a method body...
-[InheritedGetItems.xml]
?xml version=1.0 encoding=utf-8 ?

codetemplate
xmlns=http://schemas.borland.com/Delphi/2005/codetemplates;
version=1.0.0
template name=igi invoke=auto
point name=resulttype
hint
Result type
/hint
text
TtiObject
/text
/point
description
inherited GetItems(i) as TtiObject;
/description
author
Peter Hinrichsen
/author
code language=Delphi context=methodbody
delimiter=|![CDATA[result:= inherited GetItems(i) as
|resulttype|;]]
/code
/template
/codetemplate
---[end]


Here is one defining a TtiObjectList class.  Looking at it now, I
think they got the 'context= setting wrong. I emailed them to confirm
this.
[tiObjectList.xml]-
?xml version=1.0 encoding=utf-8 ?



codetemplate
xmlns=http://schemas.borland.com/Delphi/2005/codetemplates;

version=1.0.0

template name=tiol invoke=auto

description

TtiObjectList template;

/description

author

Peter Hinrichsen

/author

point name=objectclass

hint

Object's class

/hint

text

TMyObject

/text

/point

point name=objectparent

hint

Object's parent

/hint

text

TMyParent

/text

/point

point name=itemclass

hint

Item's class

/hint

text

TMyItem

/text

/point

code language=Delphi context=methodbody delimiter=|

![CDATA[

|objectclass| = class(TtiObjectList)

private

protected

 functionGetItems(i: integer): |itemclass|; reintroduce;

 procedure   SetItems(i: integer; const AValue: |itemclass|); reintroduce;

 functionGetParent: |objectparent|; reintroduce;

public

 propertyItems[i:integer] : |itemclass| read GetItems write SetItems;

 procedure   Add(AObject : |itemclass|); reintroduce;

 propertyParent: |objectparent| read GetParent;

published

end;

]]

/code

/template

/codetemplate
[end]--


Here is a nice and simple one, fixing the formatting of the 'exit'
identifier in code
[exit.xml]
?xml version=1.0 encoding=utf-8 ?

codetemplate
xmlns=http://schemas.borland.com/Delphi/2005/codetemplates;
version=1.0.0
template name=ex invoke=auto
description
Exit; //==;
/description
author
Peter Hinrichsen
/author
code language=Delphi context=methodbody ![CDATA[Exit; 
//==]]
/code
/template
/codetemplate
--[end]



--
Graeme Geldenhuys

General error, hit any user to continue.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Sam Liddicott
* Graeme Geldenhuys wrote, On 22/05/07 10:03:
 On 5/22/07, Mattias Gaertner [EMAIL PROTECTED] wrote:
 Not yet. But this is easy to implement.
 The above examples (being/end) are triggered by pressing 'return'.
 Of course not all templates should be triggered by pressing 'return',
 so every template need an own set of triggers.
 What about other triggers? For example space, tab, semicolon, ...

 'Space' must definitely be a trigger as well (in the future).
 Especially if we want to implement 'auto spellcheck' and 'auto fixing
 of case for variables and identifiers' in the IDE.


I believe such helpers should not make users dumber; and so suggest that
they keep a score for how many times they trigger but found nothing to
change, against how many changes they made when something needed changing.

Maybe even play a twinkle sound when a user gets it right after a series
of wrong.

Thus the users are trained to make the effort as well as helped.

??

Sam

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Mattias Gaertner
On Tue, 22 May 2007 15:57:55 +0100
Sam Liddicott [EMAIL PROTECTED] wrote:

 * Graeme Geldenhuys wrote, On 22/05/07 10:03:
  On 5/22/07, Mattias Gaertner [EMAIL PROTECTED] wrote:
  Not yet. But this is easy to implement.
  The above examples (being/end) are triggered by pressing 'return'.
  Of course not all templates should be triggered by pressing
  'return', so every template need an own set of triggers.
  What about other triggers? For example space, tab, semicolon, ...
 
  'Space' must definitely be a trigger as well (in the future).
  Especially if we want to implement 'auto spellcheck' and 'auto
  fixing of case for variables and identifiers' in the IDE.
 
 
 I believe such helpers should not make users dumber; and so suggest
 that they keep a score for how many times they trigger but found
 nothing to change, against how many changes they made when something
 needed changing.
 
 Maybe even play a twinkle sound when a user gets it right after a
 series of wrong.
 
 Thus the users are trained to make the effort as well as helped.
 
 ??

Fixing case of identifiers (excluding uses section) is merely a
beautification. IMO no sound needed here.
Auto replacing ';=' with ':=' is debatable.
But you got a point. For example, some programmers don't
know how to write a normal unit skeleton, because the IDE always
provides it. But I'm not sure, if this is really a bad thing.


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Lee Jenkins

Graeme Geldenhuys wrote:

On 5/22/07, Mattias Gaertner [EMAIL PROTECTED] wrote:

Not yet. But this is easy to implement.
The above examples (being/end) are triggered by pressing 'return'.
Of course not all templates should be triggered by pressing 'return',
so every template need an own set of triggers.
What about other triggers? For example space, tab, semicolon, ...


'Space' must definitely be a trigger as well (in the future).
Especially if we want to implement 'auto spellcheck' and 'auto fixing
of case for variables and identifiers' in the IDE.




That would be very, very nice to have: Case Correction.  I know that its 
not integral, but I am a stickler for case consistency and a feature 
like that would help me save time by not having to hit shift so much. 
Case correction is also help to avoid spelling mistake for identifiers 
since when you hit space, it corrects and you know its correct.


Just my opinion.

--

Warm Regards,

Lee



_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus keyword completion addon

2007-05-22 Thread Andrew Haines

 That would be very, very nice to have: Case Correction.  I know that its
 not integral, but I am a stickler for case consistency and a feature
 like that would help me save time by not having to hit shift so much.
 Case correction is also help to avoid spelling mistake for identifiers
 since when you hit space, it corrects and you know its correct.
 

memory lane
I remember using qbasic a long time ago and when you typed a var name it
would change the var's case everywhere to what you just typed. /memory
lane

Andrew

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives