[jbosstools-issues] [JBoss JIRA] (JBIDE-18752) Freemarker plugin does not work for square bracket (since JBT 4.2.0.Final)
Matteo Pelucco (JIRA)
issues at jboss.org
Thu Mar 5 11:32:49 EST 2015
[ https://issues.jboss.org/browse/JBIDE-18752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13046691#comment-13046691 ]
Matteo Pelucco edited comment on JBIDE-18752 at 3/5/15 11:32 AM:
-----------------------------------------------------------------
I've just tested: WIN8.1 + LUNA (SR2) + JBoss Tools 4.2.2 Final.
No supports by default for [ directive ]
If I try to add [#ftl] at the beginning of a template, it crash (no colours, weird keybord input responses..)
On WIN8.1 + LUNA (R) + JBoss Tools (Freemarker IDE 1.3.100)
Support for [ directive ] working pretty fine.
Waiting for a fix (or maybe, an option to enable / disable it..)
Sample template: just create a new file: test.ftl and start typing [#ftl]
You will start to see weird things, like:
{noformat}
[#ftl
]
{noformat}
or
{noformat}
[#ft ]l
{noformat}
Other more complex templates completely crashes. Something like
{noformat}
[#assign urlOg = nectarfn.createAbsoluteLink(content)!""]
[#assign defaultBaseUrl = nectarfn.defaultBaseUrl!""]
[#assign siteTitleOg = siteTitle!""]
[#assign pageTitleOg = contentPageTitle!""]
[#if siteTitleOg?has_content && siteTitleOg != "" && pageTitleOg != siteTitleOg]
[#assign pageTitleOg = "${pageTitleOg} - ${siteTitleOg}"]
[/#if]
[#assign imgOg = stkfn.getAssetLink(content, "teaserImg")!""]
[#if imgOg?has_content]
[#assign imgOg = defaultBaseUrl + imgOg]
[/#if]
[#assign abstractPageOg = content.abstract!""]
[#assign abstractPageOg = abstractPageOg?replace("<br />", " ")]
[#assign abstractPageOg = abstractPageOg?replace("<br/>", " ")]
[#assign abstractPageOg = abstractPageOg?replace("<br>", " ")]
{noformat}
was (Author: matteo.pelucco):
I've just tested: WIN8.1 + LUNA (SR2) + JBoss Tools 4.2.2 Final.
No supports by default for [ directive ]
If I try to add [#ftl] at the beginning of a template, it crash (no colours, weird keybord input responses..)
On WIN8.1 + LUNA (R) + JBoss Tools (Freemarker IDE 1.3.100)
Support for [ directive ] working pretty fine.
Waiting for a fix (or maybe, an option to enable / disable it..)
Sample template: just create a new file: test.ftl and start typing [#ftl]
You will start to see weird things, like:
[#ftl
]
or
[#ft ]l
Other more complex templates completely crashes. Something like
---
[#assign urlOg = nectarfn.createAbsoluteLink(content)!""]
[#assign defaultBaseUrl = nectarfn.defaultBaseUrl!""]
[#assign siteTitleOg = siteTitle!""]
[#assign pageTitleOg = contentPageTitle!""]
[#if siteTitleOg?has_content && siteTitleOg != "" && pageTitleOg != siteTitleOg]
[#assign pageTitleOg = "${pageTitleOg} - ${siteTitleOg}"]
[/#if]
[#assign imgOg = stkfn.getAssetLink(content, "teaserImg")!""]
[#if imgOg?has_content]
[#assign imgOg = defaultBaseUrl + imgOg]
[/#if]
[#assign abstractPageOg = content.abstract!""]
[#assign abstractPageOg = abstractPageOg?replace("<br />", " ")]
[#assign abstractPageOg = abstractPageOg?replace("<br/>", " ")]
[#assign abstractPageOg = abstractPageOg?replace("<br>", " ")]
> Freemarker plugin does not work for square bracket (since JBT 4.2.0.Final)
> --------------------------------------------------------------------------
>
> Key: JBIDE-18752
> URL: https://issues.jboss.org/browse/JBIDE-18752
> Project: Tools (JBoss Tools)
> Issue Type: Bug
> Components: freemarker
> Affects Versions: 4.2.0.Final
> Reporter: Denis Golovin
> Assignee: Max Rydahl Andersen
> Fix For: 4.3.0.Alpha2
>
>
> From https://github.com/jbosstools/jbosstools-freemarker/issues/26
> {quote}
> When using the plugin to edit freemarker files that use the square bracket syntax the editor fails to highlight the syntax (this is happening in JBoss Tools 4.20 Final).
> I think the file: src / org / jboss / ide / eclipse / freemarker / editor / DocumentProvider.java
> on line 70 is causing the syntax highlighting problem:
> {code}if (ch != LexicalConstants.SQUARE_SYNTAX_MARKER.charAt(i)) {
> return SyntaxMode.ANGLE;
> }
> SQUARE_SYNTAX_MARKER.charAt(i)
> {code}
> It should start in 0 and have a different index than i (the index of the file content) to have a proper string matching. Also, SQUARE_SYNTAX_MARKER is [#ftl, not all files start with a ftl tag, so I don't see the need for "ftl" at the end, so that's why in the following example fix I put j < 2.
> e.g.
> {code}
> int j =0;
> for (; i < docLength && j < 2; i++) {
> char ch = document.getChar(i);
> if (ch != LexicalConstants.SQUARE_SYNTAX_MARKER.charAt(j)) {
> return SyntaxMode.ANGLE;
> }
> j++;
> }
> {code}
> {quote}
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
More information about the jbosstools-issues
mailing list