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
Please sign in to leave a comment.
What exactly is
psiElement
here? Does it work if you comment out therange(psiElement)
call?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
Sorry for delay, waiting for answer..
No Problem...
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.
Hi Alexey,
I am using the *.bnf and *.flex definitions to generate my SCPI parser and the lexer.
In my PsiElement extention interfaces, I added default method getNavigationElement(), for example:
Hi. By "it didn't help" you meant `scpiElement.navigate()` method didn't navigate correctly, or this method was never called?
The method navigate() is not called at all. But as I wrote, the navigation works correctly in the editor if I press Next Highlighted Error (F2). Even then, the navigate() is not called. In other words, my breakpoint in the navigate() was never hit.
I can't seem to reproduce this problem. Is there any plugin I can download or something to try to reproduce?