Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
div
classnavigation
HTML Table
width100%
Table Row (tr)
Table Cell (td)
Align
alignleft
Previous
span
classsep
|
span
classtext
Annotator
Table Cell (td)
Align
aligncenter
Top
span
classsep
|
span
classtext
Custom Language Support
Table Cell (td) Align
alignright
Next
span
classsep
|
span
classtext
Completion Contributor Wiki Markup
{div:class=navigation}
{table:width=100%}
 {tr}
  {td} {align:left}[Previous|Annotator] {span:class=sep}\|{span} {span:class=text}Annotator{span}{align} {td}
  {td} {align:center}[Top|Custom Language Support] {span:class=sep}\|{span} {span:class=text}Custom Language Support{span}{align} {td}
  {td} {align:right}[Next|Completion Contributor] {span:class=sep}\|{span} {span:class=text}Completion Contributor{span}{align} {td}
 {tr}
{table}
{div}
Note
iconfalse

Line markers help to annotate any code with icons on the gutter. These icons may provide navigation to related code.

...

Note
iconfalse

More technical details for implementers

  • Please return line marker info for exact element you were asked for.
    For example, do not return class marker info if getLineMarkerInfo() was called for a method.
  • Please return relevant line marker info for as small element as possible.
    For example, do not return method marker for PsiMethod. Instead, return it for the PsiIdentifier which is a name of this method.

Even more technical details:

What happens when LineMarkerProvider returns something for too big PsiElement?

Code Block
public class MyLineMarkerProvider implements LineMarkerProvider {
  public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
    if (element instanceof PsiMethod) return new LineMarkerInfo(element, ...);
    return null;
  }
}

Inspection (specifically, LineMarkersPass) for performance reasons queries all LineMarkerProviders in two passes:

  1. first pass for all elements in visible area
  2. second pass for all the rest elements

If providers return nothing for either area, its line markers are cleared.
So if e.g. a method is half-visible (its name is visible but part of its body isn't) and
some poorly written LineMarkerProvider returned info for the PsiMethod instead of PsiIdentifier then:

  • the first pass removes line marker info because whole PsiMethod is not visible.
  • the second pass tries to add line marker info back because LineMarkerProvider is called for the PsiMethod at last.

As a result, line marker icon would blink annoyingly.
To fix this, rewrite LineMarkerProvider to return info for PsiIdentifier instead of PsiMethod:

Code Block
public class MyLineMarkerProvider implements LineMarkerProvider {
  public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
    if (element instanceof PsiIdentifier && element.getParent() instanceof PsiMethod) return new LineMarkerInfo(element, ...);
    return null;
  }
}

...

Now you see the icon on the gutter and can navigate to the property definition.

div
classnavigation
HTML Table
width100%
Table Row (tr)
Table Cell (td)
Align
alignleft
Previous
span
classsep
|
span
classtext
Annotator
Table Cell (td)
Align
aligncenter
Top
span
classsep
|
span
classtext
Custom Language Support
Table Cell (td) Align
alignright
Next
span
classsep
|
span
classtext
Completion Contributor Wiki Markup
{div:class=navigation}
{table:width=100%}
 {tr}
  {td} {align:left}[Previous|Annotator] {span:class=sep}\|{span} {span:class=text}Annotator{span}{align} {td}
  {td} {align:center}[Top|Custom Language Support] {span:class=sep}\|{span} {span:class=text}Custom Language Support{span}{align} {td}
  {td} {align:right}[Next|Completion Contributor] {span:class=sep}\|{span} {span:class=text}Completion Contributor{span}{align} {td}
 {tr}
{table}
{div}