Looking for XML Highlighter Extension Point

Answered

I am trying to make a plugin that highlights certain components in XML, but I can't seem to find any extension points specific to the XML language. Is it necessary that the extension point is for XML? If so, are there any extension points out there that would make this easy? 

0
4 comments

Ah I see. Was a little confused before because I had assumed you needed to be creating a Custom Language to use these features. 

I guess my next question is how do I access PSI elements from the already existing XML tree, since I am not creating my own custom tree? I understand that I have to implement the API for Annotator, SyntaxHighlighter, ColorSettingsPage, etc. and register them as extension points, but where am I getting the elements themselves that I would like to highlight? 

Is there another guide somewhere besides the documentation that provides more details on how to utilize and access the tree? 

0

It is as simple as checking whether the element passed to Annotator.annotate() is an XML element you want to annotate and creating holder.newSilentAnnotation().

Of course, you have to register the annotator with the XML language. You don't need to “own” a language you want to annotate.

Regarding the materials, I suggest looking at the intellij-community sources https://plugins.jetbrains.com/docs/intellij/explore-api.html#2-navigating-the-intellij-platform-source-code or open source plugins (https://jb.gg/ipe).

0

Please sign in to leave a comment.