Annotations "Jump to Source"

Answered

Hi,

in my Pycharm plugin, I have text editor annotations - errors and warnings. If I use the the editor shortcut F2 - Next Highlighted Error, the caret properly jumps to the problem. However, in the Tool Window Problems, where all the annotations are listed, if I double-click on the problem or use the context-menu Jump to Source (F4), the caret is not affected.

My annotation creation code:

annotationHolder.newAnnotation(HighlightSeverity.ERROR, "Invalid command header delimiter").
range(psiElement).
gutterIconRenderer(iconSyntaxError).
enforcedTextAttributes(errorWave).
tooltip("Invalid command header delimiter").
create();

My question is - how do I make the caret jump to the source from the Problems Tool Window?

 

Thanks,

Milo

5 comments
Comment actions Permalink

What exactly is psiElement here? Does it work if you comment out the range(psiElement) call?

0
Comment actions Permalink

Hi Yann,

 

the PSI Element:

 

Removing the call range(psiElement) does not change anything...

 

And as I wrote, it works correctly in the editor if I press Next Highlighted Error (F2):

The Problems also show the correct line number, but double-clicking does nothing... :-(

Milo

0
Comment actions Permalink

Sorry for delay, waiting for answer..

0
Comment actions Permalink

No Problem...

0
Comment actions Permalink

Hello. So this is some sort of your own PSI? Because It can't find ScpiTokenType anywhere.

Please make sure that the implementation of this PSI node correctly handles navigation, meaning `yourCustomPsiElement.navigate()` works.

0

Please sign in to leave a comment.