@Override
    public int compare(LookupElement lookupItem1, LookupElement lookupItem2) {
      String s1 = lookupItem1.getLookupString();
      String s2 = lookupItem2.getLookupString();
      int length = myOldReferenceName.length();
      int length1 = s1.length();
      int length2 = s2.length();
      if (length < length1) s1 = s1.substring(0, length + 1);
      if (length < length2) s2 = s2.substring(0, length + 1);
      int diff1 = EditDistance.optimalAlignment(s1, myOldReferenceName, false);
      int diff2 = EditDistance.optimalAlignment(s2, myOldReferenceName, false);
      final int diff = diff1 - diff2;
      if (diff == 0) {
        // prefer shorter string
        if (length1 < length2) return -1;
        else if (length1 > length2) return +1;
        final char c = myOldReferenceName.charAt(0);
        if (s1.charAt(0) == c) return -1;
        else if (s2.charAt(0) == c) return +1;
      }
      return diff;
    }
@Override
    public int compare(LookupElement lookupItem1, LookupElement lookupItem2)