DocumentationProvider and punctuation

Howdy.  I would like to have tooltips pop-up for every token in an editor window. All PSI nodes are of the same type and all return a reference suitable for the DocumentationProvider. My documentation pops up very nicely but only for identifiers. I realize this is an unusual request, but is there any way to make it pop up for every token in that editor? I'm including a screenshot that shows what I'm looking for. It does not give me a tooltip for the semicolon in that editor window.

My only goal is to make something that looks like that so I'm happy to use another approach if necessary. I was thinking of using balloons but I couldn't figure out how to get a raw underline or something like that in the editor window. I was guessing that there is no function that draws a line wherever I want ;)

So, my goal is to pop up information when the mouse moves over a region of text in the editor. I am almost there with tooltips using the documentation provider, but it doesn't seem to like punctuation and other non-identifiers. I'm happy to move to balloons if someone can suggest a way to underline, highlight, or otherwise demarcate regions of text in the editor given a token or PSI node or something.

thanks in advance


I think the best way to do this would be to use an annotator. You can create info annotations that don't show in the editor but have tooltips, I think, although I haven't tried that. If the data you want to display in the tooltip is calculated during parsing, you could associate the data with the element using get/putUserData.


Excellent advice, Colin. I was leaning that direction myself, though my obsessive nature would not let me drop my search to figure out why tooltips did not appear for non-identifier nodes. ;)  I have implemented my own findElementAt and findReferenceAt and might be close to making this happen!


A followup. tooltips work fine as long as a space/newline precedes the non-identifiers.  For example, x*x; highlights only x and x but "x *x ;" highlights every token.


Please sign in to leave a comment.