void (@NotNull Template template, PsiType @NotNull [] suggestedTypes, @NotNull PsiElement context) { Set<LookupElement> itemSet = new LinkedHashSet<>(); for (PsiType type : suggestedTypes) { itemSet.add(PsiTypeLookupItem.createLookupItem(type, null)); } final Result result = suggestedTypes.length > 0 ? new PsiTypeResult(suggestedTypes[0], context.getProject()) : null; Expression expr = new ConstantNode(result).withLookupItems(itemSet.size() > 1 ? itemSet : Collections.emptyList()); template.addVariable(TYPE_VAR, expr, expr, true); }