package com.jetbrains.python.codeInsight;

import com.intellij.codeInsight.navigation.GotoTargetRendererProvider;
import com.intellij.ide.util.PsiElementListCellRenderer;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiNamedElement;
import com.jetbrains.python.psi.PyElement;

/**
 * @author yole
 */
public class PyGotoTargetRendererProvider implements GotoTargetRendererProvider {
  public PsiElementListCellRenderer getRenderer(final PsiElement[] elements) {
    for(PsiElement element: elements) {
      if (!(element instanceof PyElement) || !(element instanceof PsiNamedElement)) return null;
    }
    return new PyElementListCellRenderer();
  }

}

@@ -459,18 +459,16 @@
 ment
-%5B%5D
  element
 s) %7B
@@ -467,64 +467,19 @@
 ment
-s
 ) %7B%0A
-    for(PsiElement element: elements) %7B%0A  
     if 
-(!
 (ele
@@ -507,15 +507,12 @@
 ment
-) %7C%7C !(
+ && 
 elem
@@ -546,32 +546,8 @@
 ent)
-) return null;%0A    %7D%0A   
  ret
@@ -583,15 +583,32 @@
 erer();%0A
+    return null;%0A
   %7D%0A%0A%7D%0A

Create Test: refactoring + small fixes