Examples of LookupElementBuilder


Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

    TreeUtil.ensureParsed(file.getNode());
    return state.items;
  }

  private static LookupElement createKeywordLookupItem(String keyword) {
    LookupElementBuilder builder = LookupElementBuilder.create(keyword.toLowerCase()).withCaseSensitivity(false).bold();
    boolean braces = keyword.endsWith("{") || keyword.endsWith("}");
    if (!braces) {
      return keyword.startsWith("%") ? TailTypeDecorator.withTail(builder, TailType.SPACE) : builder;
    }
    else {
      final String closing = keyword.endsWith("{") ? keyword.substring(0, keyword.length()-1) + "}" : null;
      return PrioritizedLookupElement.withPriority(builder.withInsertHandler(new InsertHandler<LookupElement>() {
        @Override
        public void handleInsert(InsertionContext context, LookupElement item) {
          int caret = context.getTailOffset();
          Document document = context.getDocument();
          StringBuilder sb = new StringBuilder("\n");
View Full Code Here

Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

        VfsUtil.processFilesRecursively(targetFile.getParent(), processor);

        List<LookupElementBuilder> elements = new ArrayList<LookupElementBuilder>();
        for (String localPackage : localPackages.getResults()) {
            LookupElementBuilder elementBuilder;

            if (importPath.startsWith("./")) {
                elementBuilder = LookupElementBuilder.create(localPackage)
                        .bold()
                        .withTypeText(
View Full Code Here

Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

    public static LookupElementBuilder createLookupElement(@NotNull GoPsiElement element, String text, @Nullable GoPsiElement child) {

        if ( child == null )
            return null;

        LookupElementBuilder lookup =
            LookupElementBuilder.create(child, text)
                                .withTailText(element.getLookupTailText())
                                .withTypeText( element.getLookupTypeText());

        LookupElementUtil visitor = new LookupElementUtil(lookup);
View Full Code Here

Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

        for (int i = 0, numMembers = members.length; i < numMembers; i++) {
            GoPsiElement member = members[i];

            if (member instanceof GoLiteralIdentifier) {
                LookupElementBuilder presentation =
                        getFieldPresentation(type, (GoLiteralIdentifier) member);

                if (presentation != null)
                    presentations[i] = presentation;
View Full Code Here

Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

        String name = id.getName();
        if (name == null)
            return null;

        LookupElementBuilder builder = LookupElementBuilder.create(id, name);

        GoPsiType ownerType = null;
        if (id.getParent() != null && id.getParent() instanceof GoTypeStructField) {
            GoTypeStructField structField = (GoTypeStructField) id.getParent();
            ownerType = (GoPsiType) structField.getParent();
        }

        if (ownerType == null) {
            return builder;
        }

        return builder
                .bold()
                .withTailText(String.format(" (defined by: %s)",
                        ownerType.getName()))
                .withTypeText("<field>", ownerType != type);
    }
View Full Code Here

Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

            if ( visiblePackageName != null && visiblePackageName.length() > 0 ) {
                typeName = String.format("%s.%s", visiblePackageName, typeName);
            }

            LookupElementBuilder lookupElement =
                LookupElementBuilder.create(typeNameDeclaration, typeName)
                                    .withIcon(icon)
                                    .withTypeText(typeText);

            variants.add(lookupElement);
View Full Code Here

Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

        }
    }

    public Object[] references() {
        for (String builtInType : builtInTypes) {
            LookupElementBuilder lookupElement =
                LookupElementBuilder.create(builtInType)
                                    .withTypeText("builtin", true)
                                    .bold();

            variants.add(lookupElement);
View Full Code Here

Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

    @Override
    public void addTarget(GoPsiElement target) {
        this.target = target;

        if (variants != null) {
            LookupElementBuilder presentation = target.getLookupPresentation();
            if ( presentation != null )
                variants.add(presentation);
        }
    }
View Full Code Here

Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

    }

    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);

        }
View Full Code Here

Examples of com.intellij.codeInsight.lookup.LookupElementBuilder

        // check for additional child node
        if(configNode instanceof Element) {

            NodeList nodeList1 = ((Element) configNode).getElementsByTagName("*");
            for (int i = 0; i < nodeList1.getLength(); i++) {
                LookupElementBuilder nodeTagLookupElement = getNodeTagLookupElement(nodeList1.item(i), isShortcut);
                if(nodeTagLookupElement != null) {
                    completionResultSet.addElement(nodeTagLookupElement);
                }
            }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.