List<TemplateImpl> (@NotNull TemplateActionContext templateActionContext, @NotNull List<TemplateImpl> candidates) { if (candidates.isEmpty()) { return candidates; } PsiFile copy = insertDummyIdentifierWithCache(templateActionContext).getFile(); List<TemplateImpl> result = new ArrayList<>(); for (TemplateImpl candidate : candidates) { if (isApplicable(candidate, TemplateActionContext.expanding( copy, templateActionContext.getStartOffset() - candidate.getKey().length()))) { result.add(candidate); } } return result; }