@Override public Comparable weigh(@NotNull LookupElement element, @NotNull CompletionLocation location) { if (PsiUtilCore.findLanguageFromElement(location.getCompletionParameters().getPosition()).isKindOf(PerlLanguage.INSTANCE)) { Integer weight = element.getUserData(WEIGHT); return weight == null ? 0 : weight; } return 0; } }