Suggestions+Questions about Manage Completion for Data-Model for the DLTK Freemarker plugin

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Suggestions+Questions about Manage Completion for Data-Model for the DLTK Freemarker plugin

angelozerr
Hi,

I have managed Model Provider for the DLTK Freemarker plugin where you
can link a Java Model class with the template editor to use it with
preview, run, debug FTL. I have start to display the model into Model
tabs (not finished). You can see attached screenshot and see the model
into Data-Model Detail (right section). It's not finishhed! But now I
would like start to use this Model Provider to manage data-model
autompletion in teh Freemarker Template editor (ex : you type '${u' +
Ctrl+Space and it display autompletion with user).

If you have some ideas about this feature, any suggestions are
welcome! Thanks. I think for instance it should be cool if the
autompletion display model coming from the Data-Model and coming from
<#assign. We could display it with different icons.

I have started to manage the autocmpletion by using the DataModel
provider and now I can display (only) a popup with user+lastetProduct
key. To do that I do :

1. get the position cursor
2. test if position cursor is included to an interpolation. To do that
I loop for the content of the template (cursor position to ${ string).
3. If I find ${ I get the key typped (ex : the template typped
contains ${u, I get 'u' as key).
4. use the 'u' key to retrieve the data-model.

I know there are another case where interpolation exist like <#if. So
I would like know if Freemarker provides utilities classes to manage
that. Get the key included into interpolation. I suppose it doesn't
exists, because you need not. In this case, do you think it's
interesting to create this utilities into the Freemarker API? Another
Tools could used that? Tell me if you are interested by this
utilities.

Regards Angelo

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel

data-model-details.png (45K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Suggestions+Questions about Manage Completion for Data-Model for the DLTK Freemarker plugin

Daniel Dekany
Tuesday, July 20, 2010, 3:32:19 PM, Angelo zerr wrote:

> Hi,
>
> I have managed Model Provider for the DLTK Freemarker plugin where you
> can link a Java Model class with the template editor to use it with
> preview, run, debug FTL. I have start to display the model into Model
> tabs (not finished). You can see attached screenshot and see the model
> into Data-Model Detail (right section). It's not finishhed! But now I
> would like start to use this Model Provider to manage data-model
> autompletion in teh Freemarker Template editor (ex : you type '${u' +
> Ctrl+Space and it display autompletion with user).
>
> If you have some ideas about this feature, any suggestions are
> welcome! Thanks. I think for instance it should be cool if the
> autompletion display model coming from the Data-Model and coming from
> <#assign. We could display it with different icons.

Note that #macro and #function also defines variables in FTL.

> I have started to manage the autocmpletion by using the DataModel
> provider and now I can display (only) a popup with user+lastetProduct
> key. To do that I do :
>
> 1. get the position cursor
> 2. test if position cursor is included to an interpolation. To do that
> I loop for the content of the template (cursor position to ${ string).
> 3. If I find ${ I get the key typped (ex : the template typped
> contains ${u, I get 'u' as key).
> 4. use the 'u' key to retrieve the data-model.
>
> I know there are another case where interpolation exist like <#if. So
> I would like know if Freemarker provides utilities classes to manage
> that. Get the key included into interpolation. I suppose it doesn't
> exists, because you need not. In this case, do you think it's
> interesting to create this utilities into the Freemarker API? Another
> Tools could used that? Tell me if you are interested by this
> utilities.

So I suppose the problem here is that you had to parse parts that
aren't turned into AST yet, as they are not yet valid FTL. So you have
to guess if what kind of place the cursor is be parsing text. BTW, I
guess this needs the same algorithm than syntax-highlighting. (I don't
know if under Eclipse they can be concretely the same, but, you get
the idea...)

In any case, I think that moving development tool support (like even
syntax-highlighting... is that possible?) into the language is a good
idea, because then the various development tools can be updated to
follow the changes in the language only by updating FreeMarker. So I
think that if you develop a solution for things like this, then those
could be moved from the plug-in into FreeMarker later. You should try
to separate all the functionality that is not specific to your Eclipse
plugin anyway. Of course when doing this, you have to try to keep
these API-s general-purpose enough, and clean enough, and we should
wait until these API-s become reasonably mature. (While we can mark
API-s in FreeMarker as experimental, public API-s still shouldn't
change wildly, otherwise what's the point...) Then these packages
could be moved over into FreeMarker (CLA is needed).

> Regards Angelo

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Suggestions+Questions about Manage Completion for Data-Model for the DLTK Freemarker plugin

angelozerr
Hi,

2010/7/21 Daniel Dekany <[hidden email]>
Tuesday, July 20, 2010, 3:32:19 PM, Angelo zerr wrote:

> Hi,
>
> I have managed Model Provider for the DLTK Freemarker plugin where you
> can link a Java Model class with the template editor to use it with
> preview, run, debug FTL. I have start to display the model into Model
> tabs (not finished). You can see attached screenshot and see the model
> into Data-Model Detail (right section). It's not finishhed! But now I
> would like start to use this Model Provider to manage data-model
> autompletion in teh Freemarker Template editor (ex : you type '${u' +
> Ctrl+Space and it display autompletion with user).
>
> If you have some ideas about this feature, any suggestions are
> welcome! Thanks. I think for instance it should be cool if the
> autompletion display model coming from the Data-Model and coming from
> <#assign. We could display it with different icons.

Note that #macro and #function also defines variables in FTL.

Ok thank's for this info.
 

> I have started to manage the autocmpletion by using the DataModel
> provider and now I can display (only) a popup with user+lastetProduct
> key. To do that I do :
>
> 1. get the position cursor
> 2. test if position cursor is included to an interpolation. To do that
> I loop for the content of the template (cursor position to ${ string).
> 3. If I find ${ I get the key typped (ex : the template typped
> contains ${u, I get 'u' as key).
> 4. use the 'u' key to retrieve the data-model.
>
> I know there are another case where interpolation exist like <#if. So
> I would like know if Freemarker provides utilities classes to manage
> that. Get the key included into interpolation. I suppose it doesn't
> exists, because you need not. In this case, do you think it's
> interesting to create this utilities into the Freemarker API? Another
> Tools could used that? Tell me if you are interested by this
> utilities.

So I suppose the problem here is that you had to parse parts that
aren't turned into AST yet, as they are not yet valid FTL. So you have
to guess if what kind of place the cursor is be parsing text. BTW, I
guess this needs the same algorithm than syntax-highlighting. (I don't
know if under Eclipse they can be concretely the same, but, you get
the idea...)

I don't know today if I can use the same code because Eclipse has  a Token API to manage syntax-highlighting.


In any case, I think that moving development tool support (like even
syntax-highlighting... is that possible?) into the language is a good
idea, because then the various development tools can be updated to
follow the changes in the language only by updating FreeMarker. So I
think that if you develop a solution for things like this, then those
could be moved from the plug-in into FreeMarker later. You should try
to separate all the functionality that is not specific to your Eclipse
plugin anyway. Of course when doing this, you have to try to keep
these API-s general-purpose enough, and clean enough, and we should
wait until these API-s become reasonably mature. (While we can mark
API-s in FreeMarker as experimental, public API-s still shouldn't
change wildly, otherwise what's the point...) Then these packages
could be moved over into FreeMarker (CLA is needed).

Ok, for the moment I have doen that in my provisonnal project. I'm waiting Atilla answer for the debugger which belong to my provisonnal project to set thoses code (if you like) to Freemarker API (when I will send my CLA).
 
Completion start working. I will send you another questions when I will commit my work.

Regards Angelo


> Regards Angelo

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Suggestions+Questions about Manage Completion for Data-Model for the DLTK Freemarker plugin

angelozerr
Hi Daniel,

For your information I have commited my work about
https://freemarker.svn.sourceforge.net/svnroot/freemarker/sandbox/org.eclipse.dltk.freemarker/freemarker.provisionnal/src/freemarker/provisionnal/ext/ide/AssistUtils.java
whic is an helper for IDE Autocompletion.

I'm using this helper to manage Data Model autocompletion. I have
created too Junit Project to test AssistUtils that you can find at
https://freemarker.svn.sourceforge.net/svnroot/freemarker/sandbox/org.eclipse.dltk.freemarker/freemarker.provisionnal.tests

You will see several tests with AssistUtils  to retrieve expression
from interpolation, list and if directives.

Regards Angelo

2010/7/22 Angelo zerr <[hidden email]>

>
> Hi,
>
> 2010/7/21 Daniel Dekany <[hidden email]>
>>
>> Tuesday, July 20, 2010, 3:32:19 PM, Angelo zerr wrote:
>>
>> > Hi,
>> >
>> > I have managed Model Provider for the DLTK Freemarker plugin where you
>> > can link a Java Model class with the template editor to use it with
>> > preview, run, debug FTL. I have start to display the model into Model
>> > tabs (not finished). You can see attached screenshot and see the model
>> > into Data-Model Detail (right section). It's not finishhed! But now I
>> > would like start to use this Model Provider to manage data-model
>> > autompletion in teh Freemarker Template editor (ex : you type '${u' +
>> > Ctrl+Space and it display autompletion with user).
>> >
>> > If you have some ideas about this feature, any suggestions are
>> > welcome! Thanks. I think for instance it should be cool if the
>> > autompletion display model coming from the Data-Model and coming from
>> > <#assign. We could display it with different icons.
>>
>> Note that #macro and #function also defines variables in FTL.
>
> Ok thank's for this info.
>
>>
>> > I have started to manage the autocmpletion by using the DataModel
>> > provider and now I can display (only) a popup with user+lastetProduct
>> > key. To do that I do :
>> >
>> > 1. get the position cursor
>> > 2. test if position cursor is included to an interpolation. To do that
>> > I loop for the content of the template (cursor position to ${ string).
>> > 3. If I find ${ I get the key typped (ex : the template typped
>> > contains ${u, I get 'u' as key).
>> > 4. use the 'u' key to retrieve the data-model.
>> >
>> > I know there are another case where interpolation exist like <#if. So
>> > I would like know if Freemarker provides utilities classes to manage
>> > that. Get the key included into interpolation. I suppose it doesn't
>> > exists, because you need not. In this case, do you think it's
>> > interesting to create this utilities into the Freemarker API? Another
>> > Tools could used that? Tell me if you are interested by this
>> > utilities.
>>
>> So I suppose the problem here is that you had to parse parts that
>> aren't turned into AST yet, as they are not yet valid FTL. So you have
>> to guess if what kind of place the cursor is be parsing text. BTW, I
>> guess this needs the same algorithm than syntax-highlighting. (I don't
>> know if under Eclipse they can be concretely the same, but, you get
>> the idea...)
>
> I don't know today if I can use the same code because Eclipse has  a Token API to manage syntax-highlighting.
>
>>
>> In any case, I think that moving development tool support (like even
>> syntax-highlighting... is that possible?) into the language is a good
>> idea, because then the various development tools can be updated to
>> follow the changes in the language only by updating FreeMarker. So I
>> think that if you develop a solution for things like this, then those
>> could be moved from the plug-in into FreeMarker later. You should try
>> to separate all the functionality that is not specific to your Eclipse
>> plugin anyway. Of course when doing this, you have to try to keep
>> these API-s general-purpose enough, and clean enough, and we should
>> wait until these API-s become reasonably mature. (While we can mark
>> API-s in FreeMarker as experimental, public API-s still shouldn't
>> change wildly, otherwise what's the point...) Then these packages
>> could be moved over into FreeMarker (CLA is needed).
>
> Ok, for the moment I have doen that in my provisonnal project. I'm waiting Atilla answer for the debugger which belong to my provisonnal project to set thoses code (if you like) to Freemarker API (when I will send my CLA).
>
> Completion start working. I will send you another questions when I will commit my work.
>
> Regards Angelo
>
>>
>> > Regards Angelo
>>
>> --
>> Best regards,
>>  Daniel Dekany
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> FreeMarker-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel