TODO's not being highlighted blue nor appearing in tree

Hello, in my custom language plugin, my TODO's are not being highlighted blue as they are for java files.

The TODO pane can find which custom language files contain TODO's, but there are no child nodes showing the exact lines they appear on.

I've implemented Parser.getCommentTokens(), returning a TokenSet containing the token COMMENT, which is defined in flex as either a line comment (//) or a block comment (/* */) - same as java.

PsiViewer shows PsiComment's in the correct places, and I've also provided an implementation of Commenter (getLineCommentPrefix(), etc) and a bunch of other things including FindUsagesProvider.

Is there something else I am missing ?

Thanks for any tips.
-vikingsteve

12 comments
Comment actions Permalink

I remember i had the same problem. I was using two different lexers for the highlighter and for the parser. As soon as i shared the tokens (i.e. both highligter and parser return the same instance of the comment token) everything worked fine.

0
Comment actions Permalink

I am having the same problem with my custom language. I have tried using the same lexer for both hilighting and parsing with no success.

Is there perhaps something more to it than just that?

0
Comment actions Permalink

Hi Dan, thanks for the tip - but that's not it. I'm only using one set of tokens here.

0
Comment actions Permalink

Jon, I'm glad someone else has the same problem!

I suspect it's due to something else not being right in the plugin.xml... perhaps a dependency on one of the other providers, contributors, etc.

Can anyone shed some light on this?

Did you also notice that plain-text files have the blue TODO highlighting enabled by default, and that there is a blue mark in the right gutter? I am wondering if there is an Annotation or code inspection class that we can just hook in...

0
Comment actions Permalink

I was able to get TODO's working by implementing the lang.syntaxHilighterFactory extension instead of the syntaxHighligher extension

http://devnet.jetbrains.net/thread/292610?tstart=30



        <!-- Syntax Hilighting extensions -->
        <lang.syntaxHighlighterFactory key="Lua" implementationClass="com.sylvanaar.idea.Lua.editor.highlighter.LuaSyntaxHighlighterFactory" />
        <!-- OLD EP <syntaxHighlighter key="Lua"  implementationClass="com.sylvanaar.idea.Lua.editor.highlighter.LuaSyntaxHighlighter" />-->


Implemented as:

public class LuaSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
  @NotNull
  protected SyntaxHighlighter createHighlighter() {
    return new LuaSyntaxHighlighter();
  }
}

0
Comment actions Permalink

Thanks a million Jon, you've made my day!

0
Comment actions Permalink

Were you able to get it working as well?

0
Comment actions Permalink

Yes, that's why I gave you a "correct answer" ;)

Thanks again, Jon. Much appreciated.

0
Comment actions Permalink

I'm glad to hear it worked for you too.

0
Comment actions Permalink

This is for others that are looking for this information. This does work except you need to change

      <lang.syntaxHighlighterFactory key="Lua" implementationClass="com.sylvanaar.idea.Lua.editor.highlighter.LuaSyntaxHighlighterFactory" />

to:

      <lang.syntaxHighlighterFactory language="Lua" implementationClass="com.sylvanaar.idea.Lua.editor.highlighter.LuaSyntaxHighlighterFactory" />


Once this was done, my Syntax highlighting back on line and now TODO's are showing up. :D

0
Comment actions Permalink

Vladimir, indeed "key" is replaced by "language", I've updated the javadoc accordingly.

0
Comment actions Permalink

Just found out that you need both key and language. 141 (aka version 14) needs key, 142 (aka EAP 15) language. I was getting highlighting in the text sample for Settings/Editor/Fonts & Colors but not in the file until I set key and language for 141.

In 142 just language was enough.

0

Please sign in to leave a comment.