Java Code Examples for com.intellij.codeInsight.lookup.LookupElementBuilder#withIcon()

The following examples show how to use com.intellij.codeInsight.lookup.LookupElementBuilder#withIcon() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@NotNull
private LookupElement buildLookupElement(PsiMethod method, String presentableMethod) {
    LookupElementBuilder builder = LookupElementBuilder.create(method);
    builder = builder.withPresentableText(presentableMethod);
    builder = builder.withTypeText(method.getContainingClass().getName(), true);
    builder = builder.withIcon(AllIcons.Nodes.Method);
    if (getCamelIdeaUtils().isAnnotatedWithHandler(method)) {
        //@Handle methods are marked with
        builder = builder.withBoldness(true);
    }
    if (method.isDeprecated()) {
        // mark as deprecated
        builder = builder.withStrikeoutness(true);
    }
    return  builder.withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE);
}
 
Example 2
public static List<LookupElement> addSmartCompletionSuggestionsContextPath(String val,
                                                                           final ComponentModel component,
                                                                           final Map<String, String> existing,
                                                                           final boolean xmlMode,
                                                                           final PsiElement psiElement) {
    final List<LookupElement> answer = new ArrayList<>();

    // show the syntax as the only choice for now
    LookupElementBuilder builder = LookupElementBuilder.create(val);
    builder = builder.withIcon(getCamelPreferenceService().getCamelIcon());
    builder = builder.withBoldness(true);
    builder = builder.withPresentableText(component.getSyntax());

    final LookupElement element = builder.withAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE);
    answer.add(element);
    val = removeUnknownEnum(val, psiElement);
    final List<LookupElement> old = addSmartCompletionContextPathEnumSuggestions(val, component, existing);
    if (!old.isEmpty()) {
        answer.addAll(old);
    }

    return answer;
}
 
Example 3
Source Project: idea-php-toolbox   File: JsonParseUtil.java    License: MIT License 6 votes vote down vote up
@NotNull
public static LookupElementBuilder getDecoratedLookupElementBuilder(@NotNull LookupElementBuilder lookupElement, @Nullable JsonRawLookupElement jsonLookup) {
    if(jsonLookup == null) {
        return lookupElement;
    }

    if(jsonLookup.getTailText() != null) {
        lookupElement = lookupElement.withTailText(jsonLookup.getTailText(), true);
    }

    if(jsonLookup.getTypeText() != null) {
        lookupElement = lookupElement.withTypeText(jsonLookup.getTypeText(), true);
    }

    String iconString = jsonLookup.getIcon();
    if(iconString != null) {
        Icon icon = getLookupIconOnString(iconString);
        if(icon != null) {
            lookupElement = lookupElement.withIcon(icon);
        }
    }

    return lookupElement;
}
 
Example 4
Source Project: consulo-unity3d   File: ShaderReference.java    License: Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
public static void consumeProperties(@Nonnull ShaderLabFile file, @Nonnull Consumer<LookupElement> consumer)
{
	for(ShaderProperty shaderProperty : file.getProperties())
	{
		String name = shaderProperty.getName();
		if(name == null)
		{
			continue;
		}
		LookupElementBuilder builder = LookupElementBuilder.create(name);
		builder = builder.withIcon((Image) AllIcons.Nodes.Property);
		ShaderPropertyType type = shaderProperty.getType();
		if(type != null)
		{
			builder = builder.withTypeText(type.getTargetText(), true);
		}
		consumer.consume(builder);
	}
}
 
Example 5
private void attachTemplateTypeCompletions(@NotNull CompletionResultSet result, @NotNull Project project, @NotNull LatteFile file) {
	LattePhpType type = LatteUtil.findFirstLatteTemplateType(file);
	if (type == null) {
		return;
	}

	Collection<PhpClass> phpClasses = type.getPhpClasses(project);
	if (phpClasses != null) {
		for (PhpClass phpClass : phpClasses) {
			for (Field field : phpClass.getFields()) {
				if (!field.isConstant() && field.getModifier().isPublic()) {
					LookupElementBuilder builder = LookupElementBuilder.create(field, "$" + field.getName());
					builder = builder.withInsertHandler(PhpVariableInsertHandler.getInstance());
					builder = builder.withTypeText(LattePhpType.create(field.getType()).toString());
					builder = builder.withIcon(PhpIcons.VARIABLE);
					if (field.isDeprecated() || field.isInternal()) {
						builder = builder.withStrikeoutness(true);
					}
					result.addElement(builder);
				}
			}
		}
	}
}
 
Example 6
private LookupElementBuilder createBuilderForMacro(LatteTagSettings tag, boolean isEndTag) {
	String name = (isEndTag ? "/" : "") + tag.getMacroName();
	LookupElementBuilder builder = LookupElementBuilder.create(name);
	builder = builder.withInsertHandler(MacroInsertHandler.getInstance());
	if (!isEndTag) {
		String appendText = tag.getType() == LatteTagSettings.Type.PAIR ? (" … {/" + tag.getMacroName() + "}") : "";
		String arguments = tag.getArgumentsInfo();
		if (arguments.length() > 0) {
			builder = builder.withTailText(" " + arguments + "}" + appendText);
		} else {
			builder = builder.withTailText("}" + appendText);
		}
	} else {
		builder = builder.withTailText("}");
	}

	if (tag.isDeprecated()) {
		builder = builder.withStrikeoutness(true);
	}
	builder = builder.withPresentableText("{" + name);
	return builder.withIcon(LatteIcons.MACRO);
}
 
Example 7
private LookupElementBuilder getNodeAttributeLookupElement(Node node, Map<String, String> nodeVars, boolean isShortcut) {

        String nodeName = getNodeName(node);
        LookupElementBuilder lookupElementBuilder = LookupElementBuilder.create(nodeName).withIcon(Symfony2Icons.CONFIG_VALUE);

        String textContent = node.getTextContent();
        if(StringUtils.isNotBlank(textContent)) {
            lookupElementBuilder = lookupElementBuilder.withTailText("(" + textContent + ")", true);
        }

        if(nodeVars.containsKey(nodeName)) {
            lookupElementBuilder = lookupElementBuilder.withTypeText(StringUtil.shortenTextWithEllipsis(nodeVars.get(nodeName), 100, 0), true);
        }

        if(isShortcut) {
            lookupElementBuilder = lookupElementBuilder.withIcon(Symfony2Icons.CONFIG_VALUE_SHORTCUT);
        }

        return lookupElementBuilder;
    }
 
Example 8
@Nullable
private LookupElementBuilder getNodeTagLookupElement(Node node, boolean isShortcut) {

    String nodeName = getNodeName(node);
    boolean prototype = isPrototype(node);

    // prototype "connection" must be "connections" so pluralize
    if(prototype) {
        nodeName = StringUtil.pluralize(nodeName);
    }

    LookupElementBuilder lookupElementBuilder = LookupElementBuilder.create(nodeName).withIcon(Symfony2Icons.CONFIG_PROTOTYPE);

    if(prototype) {
        lookupElementBuilder = lookupElementBuilder.withTypeText("Prototype", true);
    }

    if(isShortcut) {
        lookupElementBuilder = lookupElementBuilder.withIcon(Symfony2Icons.CONFIG_VALUE_SHORTCUT);
    }

    return lookupElementBuilder;
}
 
Example 9
@RequiredReadAction
private static <E extends DotNetGenericParameterListOwner & DotNetQualifiedElement> LookupElementBuilder buildTypeLikeElement(@Nonnull E element, @Nonnull DotNetGenericExtractor extractor)
{
	String genericText = CSharpElementPresentationUtil.formatGenericParameters(element, extractor);

	String name = CSharpNamedElement.getEscapedName(element);

	LookupElementBuilder builder = LookupElementBuilder.create(element, name + (extractor == DotNetGenericExtractor.EMPTY ? "" : genericText));

	builder = builder.withPresentableText(name); // always show only name

	builder = builder.withIcon(IconDescriptorUpdaters.getIcon(element, Iconable.ICON_FLAG_VISIBILITY));

	builder = builder.withTypeText(element.getPresentableParentQName());

	builder = builder.withTailText(genericText, true);

	if(extractor == DotNetGenericExtractor.EMPTY)
	{
		builder = withGenericInsertHandler(element, builder);
	}
	return builder;
}
 
Example 10
private void buildLookupElements(CompletionResultSet completionResultSet, QueryBuilderScopeContext collect) {
    for(Map.Entry<String, QueryBuilderPropertyAlias> entry: collect.getPropertyAliasMap().entrySet()) {
        DoctrineModelField field = entry.getValue().getField();
        LookupElementBuilder lookup = LookupElementBuilder.create(entry.getKey());
        lookup = lookup.withIcon(Symfony2Icons.DOCTRINE);
        if(field != null) {
            lookup = lookup.withTypeText(field.getTypeName(), true);

            if(field.getRelationType() != null) {
                lookup = lookup.withTailText("(" + field.getRelationType() + ")", true);
                lookup = lookup.withTypeText(field.getRelation(), true);
                lookup = lookup.withIcon(PhpIcons.CLASS_ICON);
            } else {
                // relation tail text wins
                String column = field.getColumn();
                if(column != null) {
                    lookup = lookup.withTailText("(" + column + ")", true);
                }
            }

        }

        // highlight fields which are possible in select statement
        if(collect.getSelects().contains(entry.getValue().getAlias())) {
            lookup = lookup.withBoldness(true);
        }

        completionResultSet.addElement(lookup);

    }
}
 
Example 11
Source Project: consulo-unity3d   File: ShaderReference.java    License: Apache License 2.0 5 votes vote down vote up
@RequiredReadAction
@Nonnull
@Override
public Object[] getVariants()
{
	ResolveKind kind = kind();
	final List<LookupElement> values = new SmartList<>();
	switch(kind)
	{
		case ATTRIBUTE:
			for(ShaderMaterialAttribute attribute : ShaderMaterialAttribute.values())
			{
				LookupElementBuilder builder = LookupElementBuilder.create(attribute.name());
				builder = builder.withIcon((Image) AllIcons.Nodes.Class);
				builder = builder.withTypeText(attribute.getType(), true);
				values.add(builder);
			}
			break;
		case PROPERTY:
			PsiFile containingFile = getContainingFile();
			if(containingFile instanceof ShaderLabFile)
			{
				consumeProperties((ShaderLabFile) containingFile, values::add);
			}
			break;
	}
	return values.toArray();
}
 
Example 12
private LookupElementBuilder createBuilderWithHelp(LatteFunctionSettings settings) {
	LookupElementBuilder builder = LookupElementBuilder.create(settings.getFunctionName());
	builder = builder.withIcon(PhpIcons.FUNCTION_ICON);
	builder = builder.withInsertHandler(MacroCustomFunctionInsertHandler.getInstance());
	if (settings.getFunctionHelp().trim().length() > 0) {
		builder = builder.withTailText(settings.getFunctionHelp());
	}
	return builder.withTypeText(settings.getFunctionReturnType());
}
 
Example 13
private LookupElementBuilder createBuilderWithHelp(LatteFilterSettings modifier) {
	LookupElementBuilder builder = LookupElementBuilder.create(modifier.getModifierName());
	if (modifier.getModifierDescription().trim().length() > 0) {
		builder = builder.withTypeText(modifier.getModifierDescription());
	}
	if (modifier.getModifierHelp().trim().length() > 0) {
		builder = builder.withTailText(modifier.getModifierHelp());
	}
	builder = builder.withInsertHandler(FilterInsertHandler.getInstance());
	return builder.withIcon(LatteIcons.MODIFIER);
}
 
Example 14
Source Project: idea-php-toolbox   File: ReturnSourceUtil.java    License: MIT License 5 votes vote down vote up
public static LookupElementBuilder buildLookupElement(@NotNull Method method, @NotNull String contents, @Nullable JsonRawLookupElement jsonRawLookupElement) {
    LookupElementBuilder lookupElement = LookupElementBuilder.create(contents);
    PhpClass phpClass = method.getContainingClass();

    if(phpClass != null) {
        lookupElement = lookupElement.withTypeText(phpClass.getPresentableFQN(), true);
        lookupElement = lookupElement.withIcon(phpClass.getIcon());
    }

    return JsonParseUtil.getDecoratedLookupElementBuilder(
        lookupElement,
        jsonRawLookupElement
    );
}
 
Example 15
@Nullable
public static LookupElementBuilder create(@NotNull HaxeModel model, @Nullable String alias) {
  PsiElement basePsi = model.getBasePsi();
  HaxeNamedComponent namedComponent = getNamedComponent(basePsi);

  if (namedComponent == null) return null;

  String name = StringUtil.defaultIfEmpty(alias, model.getName());
  String presentableText = null;
  String tailText = getParentPath(model);
  Icon icon = null;

  ItemPresentation presentation = namedComponent.getPresentation();
  if (presentation != null) {
    icon = presentation.getIcon(false);
    presentableText = presentation.getPresentableText();
  }

  LookupElementBuilder lookupElement = LookupElementBuilder.create(basePsi, name);

  if (presentableText != null) {
    if (alias != null && presentableText.startsWith(model.getName())) {
      presentableText = presentableText.replace(model.getName(), alias);
    }
    lookupElement = lookupElement.withPresentableText(presentableText);
  }

  if (icon != null) lookupElement = lookupElement.withIcon(icon);

  if (tailText != null) {
    if (alias != null) {
      tailText = HaxeBundle.message("haxe.lookup.alias", tailText + "." + model.getName());
    }
    tailText = " " + tailText;
    lookupElement = lookupElement.withTailText(tailText, true);
  }

  return lookupElement;
}
 
Example 16
public static List<LookupElement> addSmartCompletionSuggestionsQueryParameters(final String[] query,
                                                                               final ComponentModel component,
                                                                               final Map<String, String> existing,
                                                                               final boolean xmlMode,
                                                                               final PsiElement element,
                                                                               final Editor editor) {
    final List<LookupElement> answer = new ArrayList<>();

    String queryAtPosition = query[2];
    if (xmlMode) {
        queryAtPosition = queryAtPosition.replace("&amp;", "&");
    }

    final List<EndpointOptionModel> options = component.getEndpointOptions();
    // sort the options A..Z which is easier to users to understand
    options.sort((o1, o2) -> o1
            .getName()
            .compareToIgnoreCase(o2.getName()));
    queryAtPosition = removeUnknownOption(queryAtPosition, existing, element);

    for (final EndpointOptionModel option : options) {

        if ("parameter".equals(option.getKind())) {
            final String name = option.getName();

            // if we are consumer only, then any option that has producer in the label should be skipped (as its only for producer)
            final boolean consumerOnly = getCamelIdeaUtils().isConsumerEndpoint(element);
            if (consumerOnly && option
                    .getLabel()
                    .contains("producer")) {
                continue;
            }
            // if we are producer only, then any option that has consume in the label should be skipped (as its only for consumer)
            final boolean producerOnly = getCamelIdeaUtils().isProducerEndpoint(element);
            if (producerOnly && option.getLabel().contains("consumer")) {
                continue;
            }

            // only add if not already used (or if the option is multi valued then it can have many)
            final String old = existing != null ? existing.get(name) : "";
            if ("true".equals(option.getMultiValue()) || existing == null || old == null || old.isEmpty()) {

                // no tail for prefix, otherwise use = to setup for value
                final String key = option
                        .getPrefix()
                        .isEmpty() ? name : option.getPrefix();

                // the lookup should prepare for the new option
                String lookup;
                final String concatQuery = query[0];
                if (!concatQuery.contains("?")) {
                    // none existing options so we need to start with a ? mark
                    lookup = queryAtPosition + "?" + key;
                } else {
                    if (!queryAtPosition.endsWith("&") && !queryAtPosition.endsWith("?")) {
                        lookup = queryAtPosition + "&" + key;
                    } else {
                        // there is already either an ending ? or &
                        lookup = queryAtPosition + key;
                    }
                }
                if (xmlMode) {
                    lookup = lookup.replace("&", "&amp;");
                }
                LookupElementBuilder builder = LookupElementBuilder.create(lookup);
                final String suffix = query[1];
                builder = addInsertHandler(editor, builder, suffix);
                // only show the option in the UI
                builder = builder.withPresentableText(name);
                // we don't want to highlight the advanced options which should be more seldom in use
                final boolean advanced = option
                        .getGroup()
                        .contains("advanced");
                builder = builder.withBoldness(!advanced);
                if (!option.getJavaType().isEmpty()) {
                    builder = builder.withTypeText(option.getJavaType(), true);
                }
                if ("true".equals(option.getDeprecated())) {
                    // mark as deprecated
                    builder = builder.withStrikeoutness(true);
                }
                // add icons for various options
                if ("true".equals(option.getRequired())) {
                    builder = builder.withIcon(AllIcons.Toolwindows.ToolWindowFavorites);
                } else if ("true".equals(option.getSecret())) {
                    builder = builder.withIcon(AllIcons.Nodes.SecurityRole);
                } else if ("true".equals(option.getMultiValue())) {
                    builder = builder.withIcon(AllIcons.General.ArrowRight);
                } else if (!option.getEnums().isEmpty()) {
                    builder = builder.withIcon(AllIcons.Nodes.Enum);
                } else if ("object".equals(option.getType())) {
                    builder = builder.withIcon(AllIcons.Nodes.Class);
                }

                answer.add(builder.withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE));
            }
        }
    }

    return answer;
}
 
Example 17
private static List<LookupElement> addSmartCompletionContextPathEnumSuggestions(final String val,
                                                                                final ComponentModel component,
                                                                                final Map<String, String> existing) {
    final List<LookupElement> answer = new ArrayList<>();

    double priority = 100.0d;

    // lets help the suggestion list if we are editing the context-path and only have 1 enum type option
    // and the option has not been in use yet, then we can populate the list with the enum values.

    final long enums = component
            .getEndpointOptions()
            .stream()
            .filter(o -> "path".equals(o.getKind()) && !o
                    .getEnums()
                    .isEmpty())
            .count();
    if (enums == 1) {
        for (final EndpointOptionModel option : component.getEndpointOptions()) {

            // only add support for enum in the context-path smart completion
            if ("path".equals(option.getKind()) && !option
                    .getEnums()
                    .isEmpty()) {
                final String name = option.getName();
                // only add if not already used
                final String old = existing != null ? existing.get(name) : "";
                if (existing == null || old == null || old.isEmpty()) {

                    // add all enum as choices
                    for (final String choice : option
                            .getEnums()
                            .split(",")) {

                        final String key = choice;
                        final String lookup = val + key;

                        LookupElementBuilder builder = LookupElementBuilder.create(lookup);
                        // only show the option in the UI
                        builder = builder.withPresentableText(choice);
                        // lets use the option name as the type so its visible
                        builder = builder.withTypeText(name, true);
                        builder = builder.withIcon(AllIcons.Nodes.Enum);

                        if ("true".equals(option.getDeprecated())) {
                            // mark as deprecated
                            builder = builder.withStrikeoutness(true);
                        }

                        // its an enum so always auto complete the choices
                        LookupElement element = builder.withAutoCompletionPolicy(AutoCompletionPolicy.ALWAYS_AUTOCOMPLETE);

                        // they should be in the exact order
                        element = PrioritizedLookupElement.withPriority(element, priority);

                        priority -= 1.0d;

                        answer.add(element);
                    }
                }
            }
        }
    }

    return answer;
}
 
Example 18
@Nonnull
@RequiredReadAction
private static LookupElementBuilder buildLookupItem(UnityFunctionManager.FunctionInfo functionInfo, CSharpTypeDeclaration scope)
{
	StringBuilder builder = new StringBuilder();

	builder.append("void ");
	builder.append(functionInfo.getName());
	builder.append("(");

	boolean first = true;
	for(Map.Entry<String, String> entry : functionInfo.getParameters().entrySet())
	{
		if(first)
		{
			first = false;
		}
		else
		{
			builder.append(", ");
		}

		DotNetTypeRef typeRef = UnityFunctionManager.createTypeRef(scope, entry.getValue());
		builder.append(CSharpTypeRefPresentationUtil.buildShortText(typeRef, scope));
		builder.append(" ");
		builder.append(entry.getKey());
	}
	builder.append(")");

	String presentationText = builder.toString();
	builder.append("{\n");
	builder.append("}");

	LookupElementBuilder lookupElementBuilder = LookupElementBuilder.create(builder.toString());
	lookupElementBuilder = lookupElementBuilder.withPresentableText(presentationText);
	lookupElementBuilder = lookupElementBuilder.withLookupString(functionInfo.getName());
	lookupElementBuilder = lookupElementBuilder.withTailText("{...}", true);

	IconDescriptor iconDescriptor = new IconDescriptor(new IconDescriptor(AllIcons.Nodes.Method).toIcon());
	iconDescriptor.setRightIcon(Unity3dIcons.EventMethod);

	lookupElementBuilder = lookupElementBuilder.withIcon(iconDescriptor.toIcon());

	lookupElementBuilder = lookupElementBuilder.withInsertHandler(new InsertHandler<LookupElement>()
	{
		@Override
		@RequiredUIAccess
		public void handleInsert(InsertionContext context, LookupElement item)
		{
			CaretModel caretModel = context.getEditor().getCaretModel();

			PsiElement elementAt = context.getFile().findElementAt(caretModel.getOffset() - 1);
			if(elementAt == null)
			{
				return;
			}

			DotNetVirtualImplementOwner virtualImplementOwner = PsiTreeUtil.getParentOfType(elementAt, DotNetVirtualImplementOwner.class);
			if(virtualImplementOwner == null)
			{
				return;
			}

			if(virtualImplementOwner instanceof CSharpMethodDeclaration)
			{
				PsiElement codeBlock = ((CSharpMethodDeclaration) virtualImplementOwner).getCodeBlock().getElement();
				if(codeBlock instanceof CSharpBlockStatementImpl)
				{
					DotNetStatement[] statements = ((CSharpBlockStatementImpl) codeBlock).getStatements();
					if(statements.length > 0)
					{
						caretModel.moveToOffset(statements[0].getTextOffset() + statements[0].getTextLength());
					}
					else
					{
						caretModel.moveToOffset(((CSharpBlockStatementImpl) codeBlock).getLeftBrace().getTextOffset() + 1);
					}
				}
			}

			context.commitDocument();

			CodeStyleManager.getInstance(context.getProject()).reformat(virtualImplementOwner);
		}
	});
	return lookupElementBuilder;
}
 
Example 19
private LookupElementBuilder createBuilderForTag(String name) {
	LookupElementBuilder builder = LookupElementBuilder.create(name);
	builder = builder.withInsertHandler(AttrMacroInsertHandler.getInstance());
	return builder.withIcon(LatteIcons.N_TAG);
}
 
Example 20
@RequiredReadAction
private static void consumeType(final CompletionParameters completionParameters,
		CSharpReferenceExpression referenceExpression,
		Consumer<LookupElement> consumer,
		boolean insideUsingList,
		DotNetTypeDeclaration someType)
{
	final String parentQName = someType.getPresentableParentQName();
	if(StringUtil.isEmpty(parentQName))
	{
		return;
	}

	String presentationText = MsilHelper.cutGenericMarker(someType.getName());

	int genericCount;
	DotNetGenericParameter[] genericParameters = someType.getGenericParameters();
	if((genericCount = genericParameters.length) > 0)
	{
		presentationText += "<" + StringUtil.join(genericParameters, parameter -> parameter.getName(), ", ");
		presentationText += ">";
	}

	String lookupString = insideUsingList ? someType.getPresentableQName() : someType.getName();
	if(lookupString == null)
	{
		return;
	}
	lookupString = MsilHelper.cutGenericMarker(lookupString);

	DotNetQualifiedElement targetElementForLookup = someType;
	CSharpMethodDeclaration methodDeclaration = someType.getUserData(CSharpResolveUtil.DELEGATE_METHOD_TYPE);
	if(methodDeclaration != null)
	{
		targetElementForLookup = methodDeclaration;
	}
	LookupElementBuilder builder = LookupElementBuilder.create(targetElementForLookup, lookupString);
	builder = builder.withPresentableText(presentationText);
	builder = builder.withIcon(IconDescriptorUpdaters.getIcon(targetElementForLookup, Iconable.ICON_FLAG_VISIBILITY));

	builder = builder.withTypeText(parentQName, true);
	final InsertHandler<LookupElement> ltGtInsertHandler = genericCount == 0 ? null : LtGtInsertHandler.getInstance(genericCount > 0);
	if(insideUsingList)
	{
		builder = builder.withInsertHandler(ltGtInsertHandler);
	}
	else
	{
		builder = builder.withInsertHandler(new InsertHandler<LookupElement>()
		{
			@Override
			@RequiredWriteAction
			public void handleInsert(InsertionContext context, LookupElement item)
			{
				if(ltGtInsertHandler != null)
				{
					ltGtInsertHandler.handleInsert(context, item);
				}

				context.commitDocument();

				new AddUsingAction(completionParameters.getEditor(), context.getFile(), Collections.<NamespaceReference>singleton(new NamespaceReference(parentQName, null))).execute();
			}
		});
	}

	if(DotNetAttributeUtil.hasAttribute(someType, DotNetTypes.System.ObsoleteAttribute))
	{
		builder = builder.withStrikeoutness(true);
	}

	CSharpTypeLikeLookupElement element = CSharpTypeLikeLookupElement.create(builder, DotNetGenericExtractor.EMPTY, referenceExpression);
	element.putUserData(CSharpNoVariantsDelegator.NOT_IMPORTED, Boolean.TRUE);
	consumer.consume(element);
}