LookupElement[] (ExpressionContext context) { if (myItems.size() <= 1) return null; Editor editor = context.getEditor(); if (editor != null) { Document document = editor.getDocument(); PsiDocumentManager.getInstance(context.getProject()).commitDocument(document); } List<LookupElement> result = new ArrayList<>(myItems.size()); for (final SmartTypePointer item : myItems) { final PsiType type = item.getType(); if (type != null) { result.add(PsiTypeLookupItem.createLookupItem(type, null)); } } return result.toArray(LookupElement.EMPTY_ARRAY); }