FreeMarker support for NetBeans

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

FreeMarker support for NetBeans

Rafał Ostanek
Hello,
I have developed new plugin for NetBeans IDE to support FreeMarker
templates. It is already available on NetBeans Plugin Portal:
http://plugins.netbeans.org/plugin/58284/freemarker-support-for-netbeans
I just thought that you could update FreeMarker subpage "Editor/IDE
plugins" in the NetBeans section.

--
Greetings
Rafał Ostanek


------------------------------------------------------------------------------
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FreeMarker support for NetBeans

Daniel Dekany
Hi,

Thanks, I have updated http://freemarker.org/editors.html!

The examples when creating a new file is a bit odd. Especially
<@html_escape>, which is a rarely if ever used legacy. BTW, something
is off with the coloring of that stat-tag (it's mostly black after the
@, not red). You may also want to tell users where to update
freemarker.jar in case there are new bulilt-ins or directives they
want to use but are marked as errors.

(Also just in case it was missed, the list of legal directive names
can be queried from there:
freemarker.template.Configuration.getSupportedBuiltInDirectiveNames().
There's a similar method there for built-in names, if you want to
color those to at some later point.)

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FreeMarker support for NetBeans

Rafał Ostanek
Thank you for quick reply and update on the website.
I will remove <@html_escape> from template in the next version.
Colouring of start-tag looks like that, because user directive tag
consists of 2 tokens: UNIFIED_CALL and ID, while UNIFIED_CALL_END is
full tag. So I couldn't distinguish that ID from simple variable name.
freemarker-2.3.22.jar is embedded into the plugin, so user can't switch
it to different version without recompilation of the plugin. I also use
FTL.jj to generate lexer, so switching only jar won't work for syntax
solouring.
Thanks for the hint with directive names and all feedback!

On 2015-05-28 22:37, Daniel Dekany wrote:

> Hi,
>
> Thanks, I have updated http://freemarker.org/editors.html!
>
> The examples when creating a new file is a bit odd. Especially
> <@html_escape>, which is a rarely if ever used legacy. BTW, something
> is off with the coloring of that stat-tag (it's mostly black after the
> @, not red). You may also want to tell users where to update
> freemarker.jar in case there are new bulilt-ins or directives they
> want to use but are marked as errors.
>
> (Also just in case it was missed, the list of legal directive names
> can be queried from there:
> freemarker.template.Configuration.getSupportedBuiltInDirectiveNames().
> There's a similar method there for built-in names, if you want to
> color those to at some later point.)
>


------------------------------------------------------------------------------
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FreeMarker support for NetBeans

Daniel Dekany
Friday, May 29, 2015, 5:35:55 PM, Rafał Ostanek wrote:

> Thank you for quick reply and update on the website.
> I will remove <@html_escape> from template in the next version.
> Colouring of start-tag looks like that, because user directive tag
> consists of 2 tokens: UNIFIED_CALL and ID, while UNIFIED_CALL_END is
> full tag.

Surely after `<@` you have a generic expression, but I think it would
be still more logical when it comes to syntax highlighting to show
that expression with the same color as other tag names. At least as
far as it's just a simple dotted name.

> So I couldn't distinguish that ID from simple variable name.
> freemarker-2.3.22.jar is embedded into the plugin, so user can't switch
> it to different version without recompilation of the plugin. I also use
> FTL.jj to generate lexer, so switching only jar won't work for syntax
> solouring.

In the case of the Eclipse plugin it was proven to be very useful to
be able to replace freemarker.jar. I'm not sure if it can be made
possible technically in this case. Like you are saying that you are
using FTL.jj. So you re-JavaCC it for some reason? Can't the plugin
just use FMParserTokenManager for example?

BTW, if you are using the real parser, maybe you aren't far from
syntax highlight inside FTL expressions.

> Thanks for the hint with directive names and all feedback!
>
> On 2015-05-28 22:37, Daniel Dekany wrote:
>> Hi,
>>
>> Thanks, I have updated http://freemarker.org/editors.html!
>>
>> The examples when creating a new file is a bit odd. Especially
>> <@html_escape>, which is a rarely if ever used legacy. BTW, something
>> is off with the coloring of that stat-tag (it's mostly black after the
>> @, not red). You may also want to tell users where to update
>> freemarker.jar in case there are new bulilt-ins or directives they
>> want to use but are marked as errors.
>>
>> (Also just in case it was missed, the list of legal directive names
>> can be queried from there:
>> freemarker.template.Configuration.getSupportedBuiltInDirectiveNames().
>> There's a similar method there for built-in names, if you want to
>> color those to at some later point.)
>>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FreeMarker support for NetBeans

Rafał Ostanek
Thanks for the reply. Answers below.

On 2015-05-29 23:08, Daniel Dekany wrote:

> Friday, May 29, 2015, 5:35:55 PM, Rafał Ostanek wrote:
>
>> Thank you for quick reply and update on the website.
>> I will remove <@html_escape> from template in the next version.
>> Colouring of start-tag looks like that, because user directive tag
>> consists of 2 tokens: UNIFIED_CALL and ID, while UNIFIED_CALL_END is
>> full tag.
> Surely after `<@` you have a generic expression, but I think it would
> be still more logical when it comes to syntax highlighting to show
> that expression with the same color as other tag names. At least as
> far as it's just a simple dotted name.
I agree with that, but it could also be something like
<@a_hash[a_method()]> and someone could say that it is not coloured
properly, because it has a single colour.
I don't want to do too much hacks, so I colour tokens just like they are
produced by FMParserTokenManager.

>
>> So I couldn't distinguish that ID from simple variable name.
>> freemarker-2.3.22.jar is embedded into the plugin, so user can't switch
>> it to different version without recompilation of the plugin. I also use
>> FTL.jj to generate lexer, so switching only jar won't work for syntax
>> colouring.
> In the case of the Eclipse plugin it was proven to be very useful to
> be able to replace freemarker.jar. I'm not sure if it can be made
> possible technically in this case. Like you are saying that you are
> using FTL.jj. So you re-JavaCC it for some reason? Can't the plugin
> just use FMParserTokenManager for example?
I tried that, but in original FTL.jj whitespace is skipped inside FTL
expression, so it's not tokenized. In that situation lexer was not
working properly, so I have had to modify FTL.jj to treat whitespace as
tokens.
The freemarker.jar is used only for parsing and marking syntax errors.
>
> BTW, if you are using the real parser, maybe you aren't far from
> syntax highlight inside FTL expressions.
What do you mean? Aren't they already highlighted?

>
>> Thanks for the hint with directive names and all feedback!
>>
>> On 2015-05-28 22:37, Daniel Dekany wrote:
>>> Hi,
>>>
>>> Thanks, I have updated http://freemarker.org/editors.html!
>>>
>>> The examples when creating a new file is a bit odd. Especially
>>> <@html_escape>, which is a rarely if ever used legacy. BTW, something
>>> is off with the coloring of that stat-tag (it's mostly black after the
>>> @, not red). You may also want to tell users where to update
>>> freemarker.jar in case there are new bulilt-ins or directives they
>>> want to use but are marked as errors.
>>>
>>> (Also just in case it was missed, the list of legal directive names
>>> can be queried from there:
>>> freemarker.template.Configuration.getSupportedBuiltInDirectiveNames().
>>> There's a similar method there for built-in names, if you want to
>>> color those to at some later point.)
>>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> FreeMarker-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>>


------------------------------------------------------------------------------
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FreeMarker support for NetBeans

Daniel Dekany
[...]
>> possible technically in this case. Like you are saying that you are
>> using FTL.jj. So you re-JavaCC it for some reason? Can't the plugin
>> just use FMParserTokenManager for example?
> I tried that, but in original FTL.jj whitespace is skipped inside FTL
> expression, so it's not tokenized. In that situation lexer was not
> working properly, so I have had to modify FTL.jj to treat whitespace as
> tokens.

Though the information about the skipped whitespace sections isn't
lost, because the position of the token's beginning and ending in the
original text is part of the Token object. The gaps between those
positions are the ignored whitespace.

> The freemarker.jar is used only for parsing and marking syntax errors.

So just by replacing freemarker.jar one could avoid false error
markers when using new built-ins/directives/operators. Syntax
highlighting is trickier for sure. New directives generate new tokens
(which is silly... one day I intend to fix that), and new operators
too, obviously. But luckily, new built-ins (the ?something stuff)
don't, and they are the most frequent problem after new releases. For
the new kind of tokens there could be a heuristic token type
categorizer, which makes a guess based on Token.image. Like if you get
Token.image "<#foo", that must be a new directive's start-tag opener.

>> BTW, if you are using the real parser, maybe you aren't far from
>> syntax highlight inside FTL expressions.
> What do you mean? Aren't they already highlighted?

Indeed, now that I'm trying harder, some of them are, like "..." and
() and []. But most things are just black, that's what confused me. I
think operators like "+", "." etc. should be colored differently.

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Loading...