Is it possible to understand which phase right now in LineMarkerProviders?
Answered
Hello,
This documentation
LineMarkersPass queries all LineMarkerProviders in two phases:
- The first pass is for all elements visible in the Editor window,
- The second pass is for the rest of the elements in the file.
Is it possible to understand is it first phase or second in LineMarkerProviders?
Please sign in to leave a comment.
Hi Alexandr,
What is the use case? Why do you need this?
Hi Karol,
Thank you for your response! I implemented LineMarkerProviderDescriptor. And I need to show gutter icons for provided lines. But for different languages, I have different results. For example, if it's Language.ANY (plain text) will display a gutter icon only once. But if I install the Python plugin (for example) and open some test.py file it will show a gutter icon twice.
To find PsiElement for line I use next code
And getTextRange(element, targetOffset) method could return TextRange(targetOffset, targetOffset) for Language.ANY and psiElement.textRange for some specific icon
I'm sorry, but I still don't get why you need to know in which phase your marker is added. Do I understand correctly that you get duplicate gutter icons in Python files, and you want to know which phase you are in for debugging purposes?
This part can be your entry point for debugging the issue: https://github.com/JetBrains/intellij-community/blob/master/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LineMarkersPassFactory.java#L44