making <remove> .. </remove>-wrapped code look like a comment (JSF syntax coloring)

hi,
I'm working on a simple plugin that will make JSF <remove> ... </remove> - enclosed code in a JSF xhtml file look like a comment.
I managed to cook up a working custom annotator which applies comment-style formatting to the code inside these tags - the problem is the annotator does not always trigger. When there's a syntax / missing taglib error, the 'error highlighter' takes precedence and my annotator gets skipped.
I considered using syntax highlighter (<lang.syntaxHighlighterFactory> extension point) instead of an annotator as it better suits my needs (I need no contextual information to perform code coloring - it's purely syntax-based) but since it's not really a new language plugin I'm working with I have no idea how to get round to it. For starters I have no file type to associate the syntax highlighter with and AFAIK there can be only one syntax highlighter for a single file type.
Any thoughts on how to properly implement the discribed functionality would be greatly appreciated.
TXH in advance
Simon

4 comments
Comment actions Permalink

Hello Imants,
thank you for a quick response
I don't know the folding API very well - haven't used it in my previous plugin.
Is it possible to register a folding builder for an existing language or do I need to create my own pseudo-language for that purpose ?
I registered a builder in plugin.xml using the code snippet below

<lang.foldingBuilder language="JSPX" implementationClass="pl.com.tiger.syntax.highlighter.plugin.UIRemoveFoldingBuilder"/>

and when I open an XHTML file with facelets - nothing happens (the folding builder does not trigger).
I also tried replacing 'JSPX' with 'Facelets' as a language key but it didn't trigger my builder either so I'm stuck :(

0
Comment actions Permalink

> Is it possible to register a folding builder for an existing language

it should be possible, yes.

to get a list of all available languages, put a breakpoint anywhere in the plugin code and evaluate this:

Language.getRegisteredLanguages()

0
Comment actions Permalink

well, I gave folding builder a try but it doesn't seem to do anything to the 'folded' code - probably because of JSPX own folding builder (you can fold <ui:remove> contents by default - without any custom extensions)
So thanks for a hint but it seems to be a dead end.
I'm gonna try out a syntax highlighter - maybe it'll work.

0

Please sign in to leave a comment.