ColorSettingsPage

I'm playing around with the custom language API and have a class RubyColorSettingsPage that implements the ColorSettingsPage interface. When I bring up the color settings page I get proper highlighting for keywords, strings, etc. but the annotation phase highlighting, e.g., instance variables, class names, etc. aren't highlighted.

The ColorSettingsPage interface only returns a SyntaxHighlighter which is the lexer highlighter. Is there some way to have the color settings page invoke the annotation phase?

Secondly, what's the purpose of the getAdditionalHighlightingTagToDescriptionMap method?

6 comments

Hello Charles,

Your two questions are actually the one.

getAdditionalHighlightingTagToDescriptionMap() is intended to return a map
from tag names in preview text to text attributes it aimed to demo.
For instance, Java page returns map that contains entry "class" -> CodeInsightColors.CLASS_NAME_ATTRIBUTES
and preview starts with:
"/* Block comment */\n" +
"import java.util.Date]]>;\n" +
...

So we do not launch real annotating process but patch preview text instead.

-


Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I'm playing around with the custom language API and have a class
RubyColorSettingsPage that implements the ColorSettingsPage interface.
When I bring up the color settings page I get proper highlighting for
keywords, strings, etc. but the annotation phase highlighting, e.g.,
instance variables, class names, etc. aren't highlighted.

The ColorSettingsPage interface only returns a SyntaxHighlighter which
is the lexer highlighter. Is there some way to have the color
settings page invoke the annotation phase?

Secondly, what's the purpose of the
getAdditionalHighlightingTagToDescriptionMap method?





0

Clever! I got the first element to highlight correctly, e.g., "class First" but when I add the second element it results in an error ("module Second]]>"):

String index out of range: -67
java.lang.StringIndexOutOfBoundsException: String index out of range: -67
at java.lang.String.substring(String.java:1768)
at com.intellij.application.options.colors.highlighting.HighlightsExtractor.cutDefinedTags(HighlightsExtractor.java:60)
...

0

Hello Charles,

CW> Clever! I got the first element to highlight correctly, e.g.,
CW> "class First" but when I add the second element it results in CW> an error ("module Second"): CW> CW> String index out of range: -67 CW> java.lang.StringIndexOutOfBoundsException: String index out of CW> range: -67 CW> at java.lang.String.substring(String.java:1768) CW> at CW> com.intellij.application.options.colors.highlighting.HighlightsExtra CW>]]> ctor.cutDefinedTags(HighlightsExtractor.java:60)

Which version of IDEA are you using? This exception should be fixed in IDEA
5.0.2.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

5.0.1 - I decompiled the code and found the problem anyway. Did you fix the issue by searching from the '<' for the '>' or by doing more complex parsing?

0

Hello Charles,

CW> 5.0.1 - I decompiled the code and found the problem anyway. Did you
CW> fix the issue by searching from the '<' for the '>' or by doing more
CW> complex parsing?

The former. The parsing is still as simple as it was.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

Thanks for the help. Everything's working perfectly now.

0

Please sign in to leave a comment.