List<TemplateImpl> (@NotNull String key, @Nullable Character shortcutChar, boolean hasArgument) { final Collection<TemplateImpl> templates = getTemplates(key); if (templates.isEmpty()) { return Collections.emptyList(); } List<TemplateImpl> candidates = new ArrayList<>(); for (TemplateImpl template : templates) { if (template.isDeactivated()) { continue; } if (shortcutChar != null && getShortcutChar(template) != shortcutChar) { continue; } if (hasArgument && !template.hasArgument()) { continue; } candidates.add(template); } return candidates; }