[jbosstools-issues] [JBoss JIRA] (JBIDE-18752) Freemarker plugin does not work for square bracket (since JBT 4.2.0.Final)

Nick Boldt (JIRA) issues at jboss.org
Thu Nov 13 14:25:29 EST 2014


    [ https://issues.jboss.org/browse/JBIDE-18752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019886#comment-13019886 ] 

Nick Boldt edited comment on JBIDE-18752 at 11/13/14 2:24 PM:
--------------------------------------------------------------

Suggested fix, from https://github.com/jbosstools/jbosstools-freemarker/issues/26#issuecomment-62947370:

{quote}
Here is my idea for the fix. I think this code will work for freemarker 2.3 and 2.4:

https://gist.githubusercontent.com/carofe82/bb3ab72ed692c7c91165/raw/74fe1f7a817de7e73ec83de22ba3927f8af4de54/gistfile1.diff
{quote}


was (Author: nickboldt):
Suggested fix:

{quote}
Here is my idea for the fix. I think this code will work for freemarker 2.3 and 2.4:

https://gist.githubusercontent.com/carofe82/bb3ab72ed692c7c91165/raw/74fe1f7a817de7e73ec83de22ba3927f8af4de54/gistfile1.diff
{quote}

> 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: Nick Boldt
>
> 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.8#6338)


More information about the jbosstools-issues mailing list