DLTK Freemarker plugin Syntax Coloring.

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

DLTK Freemarker plugin Syntax Coloring.

angelozerr
Hi Daniel,

I have worked (it's commited, you must get source from teh whole
projects)  about Syntax Coloring and I manage few FTLL Tag (<#list,
<#assign, <#if, <#else and interpolation). I have attached 2 screen
where you can see a Struts2 FTL file form-close.ftl opened with :

* DLTK Freemarker Plugin.
* JBoss Freemarker IDE Plugin.

You will notice several improvement with DLTK :

* Folding management for Freemarker comments. You can expand/collapse
Freemarker comments. (it was very easy to implement that with DLTK). I
think it should be cool to do the same thing for macro and Freemarker
function but to do that FM Parse must be improved (It must be more
tollerant). You can customize Folding (with Preferences) but by
default comments is collapsed when comments line >2.
* With JBoss plugin FTL Tag are only blue. With DLTK you detect the
start/end tag and body tag. Into teh body tag you can add some rules
(like set "as" keyword only for list directive).
* Interpolation rule start/end with dark blue and the body is normal
blue (like directive).

and regression :

* HTML Tag are not colored (as you have already suggested me). But I
would like manage that into another plugin (wuth Extension Point
Eclipse).
* String are not colored.

I have 2 questions :

1) I have used standard color from DLTK but I would like know if you
are OK with this color. (You can change the color with Preferences,
but I think it should be better to have a clean colors by default).

2) It's possible to color another token (I would like manage String
token) but I don't know if it's interesting (build-in coloration?
number coloration? assignement variable coloration?....) I would like
just know if you have some ideas about that.

Thank's for your feedback.

Regards Angelo

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel

form-close-dltk.png (57K) Download Attachment
form-close-jboss.png (43K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: DLTK Freemarker plugin Syntax Coloring.

Daniel Dekany
Monday, August 2, 2010, 11:12:13 AM, Angelo zerr wrote:

> Hi Daniel,
>
> I have worked (it's commited, you must get source from teh whole
> projects)  about Syntax Coloring and I manage few FTLL Tag (<#list,
> <#assign, <#if, <#else and interpolation). I have attached 2 screen
> where you can see a Struts2 FTL file form-close.ftl opened with :
>
> * DLTK Freemarker Plugin.
> * JBoss Freemarker IDE Plugin.
>
> You will notice several improvement with DLTK :
>
> * Folding management for Freemarker comments. You can expand/collapse
> Freemarker comments. (it was very easy to implement that with DLTK). I
> think it should be cool to do the same thing for macro and Freemarker
> function but to do that FM Parse must be improved (It must be more
> tollerant). You can customize Folding (with Preferences) but by
> default comments is collapsed when comments line >2.
> * With JBoss plugin FTL Tag are only blue. With DLTK you detect the
> start/end tag and body tag. Into teh body tag you can add some rules
> (like set "as" keyword only for list directive).
> * Interpolation rule start/end with dark blue and the body is normal
> blue (like directive).

Great so far.

> and regression :
>
> * HTML Tag are not colored (as you have already suggested me). But I
> would like manage that into another plugin (wuth Extension Point
> Eclipse).
> * String are not colored.
>
> I have 2 questions :
>
> 1) I have used standard color from DLTK but I would like know if you
> are OK with this color. (You can change the color with Preferences,
> but I think it should be better to have a clean colors by default).

It's almost OK, but here are the problems:

- Do not use italic fonts for the expressions. They are difficult to
  read, especially if someone doesn't use ClearType. Maybe it sounds
  like nick-picking, but expressions take out the most of the FTL code
  you write, so... while italic font is OK for comments and like, it's
  certainly not acceptable for all the expressions.

- Interpolations are too difficult to spot, as dark-blue and black
  looks almost the same on most screens. Something lighter is needed,
  maybe something similar to the redish-purple of keywords

> 2) It's possible to color another token (I would like manage String
> token) but I don't know if it's interesting (build-in coloration?
> number coloration? assignement variable coloration?....) I would like
> just know if you have some ideas about that.

I think built-ins and special variables (like .vars) should be colored
as keywords and directive-names are now, only they shouldn't be bold.
(It's a normal programmer reflex to wait for the word to change color
when you type a word that's part of the language... it's a feedback
that tells you that you remember it correctly, also for the readers of
the code it tells that they should look up the thing in the Manual of
the language, rather than in the in-house code-base.)

String literals should have a distinct color by default. Otherwise let
the Java code editor of Eclipse be your guide here... There, while you
can set the colors of many things individually, by default most stuff
just have the same RGB value. I think that's a the cleanest approach:
the language elements that you recognize should have their individual
color settings, only by default most of them should be set to the same
color. Especially as recognizing language elements is important for
auto-completion anyway, I don't think it's more work to do it this
way. You can even use some funny color settings as a way of checking
if your code works well.

> Thank's for your feedback.
>
> Regards Angelo

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: DLTK Freemarker plugin Syntax Coloring.

angelozerr
Hi Daniel,

Thank's for your feedback.

2010/8/3 Daniel Dekany <[hidden email]>:

> Monday, August 2, 2010, 11:12:13 AM, Angelo zerr wrote:
>
>> Hi Daniel,
>>
>> I have worked (it's commited, you must get source from teh whole
>> projects)  about Syntax Coloring and I manage few FTLL Tag (<#list,
>> <#assign, <#if, <#else and interpolation). I have attached 2 screen
>> where you can see a Struts2 FTL file form-close.ftl opened with :
>>
>> * DLTK Freemarker Plugin.
>> * JBoss Freemarker IDE Plugin.
>>
>> You will notice several improvement with DLTK :
>>
>> * Folding management for Freemarker comments. You can expand/collapse
>> Freemarker comments. (it was very easy to implement that with DLTK). I
>> think it should be cool to do the same thing for macro and Freemarker
>> function but to do that FM Parse must be improved (It must be more
>> tollerant). You can customize Folding (with Preferences) but by
>> default comments is collapsed when comments line >2.
>> * With JBoss plugin FTL Tag are only blue. With DLTK you detect the
>> start/end tag and body tag. Into teh body tag you can add some rules
>> (like set "as" keyword only for list directive).
>> * Interpolation rule start/end with dark blue and the body is normal
>> blue (like directive).
>
> Great so far.

Cool:)

>
>> and regression :
>>
>> * HTML Tag are not colored (as you have already suggested me). But I
>> would like manage that into another plugin (wuth Extension Point
>> Eclipse).
>> * String are not colored.
>>
>> I have 2 questions :
>>
>> 1) I have used standard color from DLTK but I would like know if you
>> are OK with this color. (You can change the color with Preferences,
>> but I think it should be better to have a clean colors by default).
>
> It's almost OK, but here are the problems:
>
> - Do not use italic fonts for the expressions. They are difficult to
>  read, especially if someone doesn't use ClearType. Maybe it sounds
>  like nick-picking, but expressions take out the most of the FTL code
>  you write, so... while italic font is OK for comments and like, it's
>  certainly not acceptable for all the expressions.

You are right. I have changed that. Expression is not with italic
styles (by default).

>
> - Interpolations are too difficult to spot, as dark-blue and black
>  looks almost the same on most screens. Something lighter is needed,
>  maybe something similar to the redish-purple of keywords
>

Ok. Could you help me with that?  It's very easy to change that. The
preferences color are managed with
https://freemarker.svn.sourceforge.net/svnroot/freemarker/sandbox/org.eclipse.dltk.freemarker/org.eclipse.dltk.freemarker.ui/src/org/eclipse/dltk/freemarker/internal/ui/FreemarkerPreferenceConstants.java

Here the code to set styles preferences for expression :

// Editor expression, .. color, bold, italic
PreferenceConverter.setDefault(store,
                        EDITOR_EXPRESSION_COLOR, new RGB(
                                                0, 0, 192));
store.setDefault(EDITOR_EXPRESSION_BOLD, false);
store.setDefault(EDITOR_EXPRESSION_ITALIC, false);

I think it's very basic. Is it possible for you to play With
Window->Preferences
Freemarker->Editor->Syntax Coloring. You can change color, bold italic
and you have a Preview to see at runtime your change. After you can
get RGB color and modify FreemarkerPreferenceConstants.java

Thanks for your help. I think it should better that you done that and
it will avoid having a lot of post about color choose. What do you
think?

>> 2) It's possible to color another token (I would like manage String
>> token) but I don't know if it's interesting (build-in coloration?
>> number coloration? assignement variable coloration?....) I would like
>> just know if you have some ideas about that.
>
> I think built-ins and special variables (like .vars) should be colored
> as keywords and directive-names are now, only they shouldn't be bold.
> (It's a normal programmer reflex to wait for the word to change color
> when you type a word that's part of the language... it's a feedback
> that tells you that you remember it correctly, also for the readers of
> the code it tells that they should look up the thing in the Manual of
> the language, rather than in the in-house code-base.)
>
> String literals should have a distinct color by default. Otherwise let
> the Java code editor of Eclipse be your guide here... There, while you
> can set the colors of many things individually, by default most stuff
> just have the same RGB value. I think that's a the cleanest approach:
> the language elements that you recognize should have their individual
> color settings, only by default most of them should be set to the same
> color.

Ok I will try to do that.

>Especially as recognizing language elements is important for
> auto-completion anyway, I don't think it's more work to do it this
> way. You can even use some funny color settings as a way of checking
> if your code works well.
You are right, I think we could use IToken created from IRule for
Syntax Coloring with autoimpletion. I'm studying that.

>
>> Thank's for your feedback.
>>
>> Regards Angelo
>
> --
> Best regards,
>  Daniel Dekany
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: DLTK Freemarker plugin Syntax Coloring.

angelozerr
Daniel I have forgotten tell you that I have commited the project
https://freemarker.svn.sourceforge.net/svnroot/freemarker/sandbox/org.eclipse.dltk.freemarker/DLTK-Freemarker-FTL-Samples
It's a Freemarker Project (with Freemarker nature) wich contain
several FTL files. I have tried to manage the whole cases (ex <#if
(1>2) > doesn't closed to the first > but to the second because it's
enclosed with '(' character.

If you see problem with coloration, please add your file (or update a
file because I have created a file per directives).

This project is kind of Human Junit.


 I have worked (it's commited, you must get source from teh whole

>>> projects)  about Syntax Coloring and I manage few FTLL Tag (<#list,
>>> <#assign, <#if, <#else and interpolation). I have attached 2 screen
>>> where you can see a Struts2 FTL file form-close.ftl opened with :
>>>
>>> * DLTK Freemarker Plugin.
>>> * JBoss Freemarker IDE Plugin.
>>>
>>> You will notice several improvement with DLTK :
>>>
>>> * Folding management for Freemarker comments. You can expand/collapse
>>> Freemarker comments. (it was very easy to implement that with DLTK). I
>>> think it should be cool to do the same thing for macro and Freemarker
>>> function but to do that FM Parse must be improved (It must be more
>>> tollerant). You can customize Folding (with Preferences) but by
>>> default comments is collapsed when comments line >2.
>>> * With JBoss plugin FTL Tag are only blue. With DLTK you detect the
>>> start/end tag and body tag. Into teh body tag you can add some rules
>>> (like set "as" keyword only for list directive).
>>> * Interpolation rule start/end with dark blue and the body is normal
>>> blue (like directive).
>>
>> Great so far.
>
> Cool:)
>
>>
>>> and regression :
>>>
>>> * HTML Tag are not colored (as you have already suggested me). But I
>>> would like manage that into another plugin (wuth Extension Point
>>> Eclipse).
>>> * String are not colored.
>>>
>>> I have 2 questions :
>>>
>>> 1) I have used standard color from DLTK but I would like know if you
>>> are OK with this color. (You can change the color with Preferences,
>>> but I think it should be better to have a clean colors by default).
>>
>> It's almost OK, but here are the problems:
>>
>> - Do not use italic fonts for the expressions. They are difficult to
>>  read, especially if someone doesn't use ClearType. Maybe it sounds
>>  like nick-picking, but expressions take out the most of the FTL code
>>  you write, so... while italic font is OK for comments and like, it's
>>  certainly not acceptable for all the expressions.
>
> You are right. I have changed that. Expression is not with italic
> styles (by default).
>
>>
>> - Interpolations are too difficult to spot, as dark-blue and black
>>  looks almost the same on most screens. Something lighter is needed,
>>  maybe something similar to the redish-purple of keywords
>>
>
> Ok. Could you help me with that?  It's very easy to change that. The
> preferences color are managed with
> https://freemarker.svn.sourceforge.net/svnroot/freemarker/sandbox/org.eclipse.dltk.freemarker/org.eclipse.dltk.freemarker.ui/src/org/eclipse/dltk/freemarker/internal/ui/FreemarkerPreferenceConstants.java
>
> Here the code to set styles preferences for expression :
>
> // Editor expression, .. color, bold, italic
> PreferenceConverter.setDefault(store,
>                        EDITOR_EXPRESSION_COLOR, new RGB(
>                                                0, 0, 192));
> store.setDefault(EDITOR_EXPRESSION_BOLD, false);
> store.setDefault(EDITOR_EXPRESSION_ITALIC, false);
>
> I think it's very basic. Is it possible for you to play With
> Window->Preferences
> Freemarker->Editor->Syntax Coloring. You can change color, bold italic
> and you have a Preview to see at runtime your change. After you can
> get RGB color and modify FreemarkerPreferenceConstants.java
>
> Thanks for your help. I think it should better that you done that and
> it will avoid having a lot of post about color choose. What do you
> think?
>
>>> 2) It's possible to color another token (I would like manage String
>>> token) but I don't know if it's interesting (build-in coloration?
>>> number coloration? assignement variable coloration?....) I would like
>>> just know if you have some ideas about that.
>>
>> I think built-ins and special variables (like .vars) should be colored
>> as keywords and directive-names are now, only they shouldn't be bold.
>> (It's a normal programmer reflex to wait for the word to change color
>> when you type a word that's part of the language... it's a feedback
>> that tells you that you remember it correctly, also for the readers of
>> the code it tells that they should look up the thing in the Manual of
>> the language, rather than in the in-house code-base.)
>>
>> String literals should have a distinct color by default. Otherwise let
>> the Java code editor of Eclipse be your guide here... There, while you
>> can set the colors of many things individually, by default most stuff
>> just have the same RGB value. I think that's a the cleanest approach:
>> the language elements that you recognize should have their individual
>> color settings, only by default most of them should be set to the same
>> color.
>
> Ok I will try to do that.
>
>>Especially as recognizing language elements is important for
>> auto-completion anyway, I don't think it's more work to do it this
>> way. You can even use some funny color settings as a way of checking
>> if your code works well.
> You are right, I think we could use IToken created from IRule for
> Syntax Coloring with autoimpletion. I'm studying that.
>>
>>> Thank's for your feedback.
>>>
>>> Regards Angelo
>>
>> --
>> Best regards,
>>  Daniel Dekany
>>
>>
>> ------------------------------------------------------------------------------
>> The Palm PDK Hot Apps Program offers developers who use the
>> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>> of $1 Million in cash or HP Products. Visit us here for more details:
>> http://p.sf.net/sfu/dev2dev-palm
>> _______________________________________________
>> FreeMarker-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>>
>

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel