@Override
  protected void addCompletions(
      @NotNull CompletionParameters completionParameters,
      ProcessingContext processingContext,
      @NotNull CompletionResultSet completionResultSet) {

    if (!Symfony2ProjectComponent.isEnabled(completionParameters.getPosition())) {
      return;
    }

    XmlEventParser xmlEventParser =
        ServiceXmlParserFactory.getInstance(
            completionParameters.getPosition().getProject(), XmlEventParser.class);
    for (Map.Entry<String, String> event : xmlEventParser.get().entrySet()) {
      completionResultSet.addElement(
          LookupElementBuilder.create(event.getKey())
              .withTypeText(event.getValue(), true)
              .withIcon(Symfony2Icons.EVENT));
    }

    for (EventDispatcherSubscribedEvent event :
        EventDispatcherSubscriberUtil.getSubscribedEvents(
            completionParameters.getPosition().getProject())) {
      completionResultSet.addElement(
          LookupElementBuilder.create(event.getStringValue())
              .withTypeText("EventSubscriber", true)
              .withIcon(Symfony2Icons.EVENT));
    }
  }
  public KeywordCompletionProvider() {
    super();

    for (String keyword : KEYWORDS) {
      KEYWORD_LOOKUPS.add(LookupElementBuilder.create(keyword));
      ATTR_LOOKUPS.add(LookupElementBuilder.create("n:" + keyword));
    }
    for (String filter : FILTERS) FILTER_LOOKUPS.add(LookupElementBuilder.create(filter));
  }
Example #3
0
 @NotNull
 public static LookupElementBuilder createPropertyLookupElement(
     @NotNull String name, @Nullable PsiType type) {
   LookupElementBuilder res =
       LookupElementBuilder.create(name).withIcon(JetgroovyIcons.Groovy.Property);
   if (type != null) {
     res = res.withTypeText(type.getPresentableText());
   }
   return res;
 }
 @Override
 public LookupElementBuilder createLookupBuilder(@NotNull VcsRef item) {
   LookupElementBuilder lookupBuilder = super.createLookupBuilder(item);
   if (myColorManager.isMultipleRoots()) {
     lookupBuilder =
         lookupBuilder.withTypeText(
             getTypeText(item),
             new ColorIcon(
                 15, VcsLogGraphTable.getRootBackgroundColor(item.getRoot(), myColorManager)),
             true);
   }
   return lookupBuilder;
 }
Example #5
0
 private void processProperty(
     @NotNull PsiMethod method, @NotNull GroovyResolveResult resolveResult) {
   if (myIsMap) return;
   final LookupElementBuilder lookup =
       createPropertyLookupElement(method, resolveResult, myMatcher);
   if (lookup != null) {
     if (myPropertyNames.add(lookup.getLookupString())) {
       myConsumer.consume(lookup);
     }
   } else if (myEventListener != null) {
     processListenerProperties(method);
   }
 }
    @Override
    protected void addCompletions(
        @NotNull CompletionParameters completionParameters,
        ProcessingContext processingContext,
        @NotNull CompletionResultSet completionResultSet) {
      YAMLKeyValue yamlKeyValue =
          PsiTreeUtil.getParentOfType(
              completionParameters.getOriginalPosition(), YAMLKeyValue.class);
      if (yamlKeyValue != null) {
        PsiElement compoundValue = yamlKeyValue.getParent();
        if (compoundValue instanceof YAMLCompoundValue) {

          // path and pattern are valid
          String pattern =
              YamlHelper.getYamlKeyValueAsString((YAMLCompoundValue) compoundValue, "path", false);
          if (pattern == null) {
            pattern =
                YamlHelper.getYamlKeyValueAsString(
                    (YAMLCompoundValue) compoundValue, "pattern", false);
          }

          if (pattern != null) {
            Matcher matcher = Pattern.compile("\\{(\\w+)}").matcher(pattern);
            while (matcher.find()) {
              completionResultSet.addElement(LookupElementBuilder.create(matcher.group(1)));
            }
          }
        }
      }
    }
 @Override
 public LookupElement createLookupElement(String s) {
   return LookupElementBuilder.create(s)
       .withIcon(icons.MavenIcons.MavenPlugin)
       .withTailText(
           " (" + MavenRepositoriesProvider.getInstance().getRepositoryUrl(s) + ")", true);
 }
Example #8
0
    private void processListenerProperties(@NotNull PsiMethod method) {
      if (!method.getName().startsWith("add")
          || method.getParameterList().getParametersCount() != 1) return;

      final PsiParameter parameter = method.getParameterList().getParameters()[0];
      final PsiType type = parameter.getType();
      if (!(type instanceof PsiClassType)) return;

      final PsiClassType classType = (PsiClassType) type;
      final PsiClass listenerClass = classType.resolve();
      if (listenerClass == null) return;

      final PsiMethod[] listenerMethods = listenerClass.getMethods();
      if (!InheritanceUtil.isInheritorOrSelf(listenerClass, myEventListener, true)) return;

      for (PsiMethod listenerMethod : listenerMethods) {
        final String name = listenerMethod.getName();
        if (myPropertyNames.add(name)) {
          LookupElementBuilder builder =
              LookupElementBuilder.create(
                      generatePropertyResolveResult(name, listenerMethod, null, null), name)
                  .withIcon(JetgroovyIcons.Groovy.Property);
          myConsumer.consume(builder);
        }
      }
    }
    @Override
    protected void addCompletions(
        @NotNull CompletionParameters parameters,
        ProcessingContext context,
        @NotNull CompletionResultSet result) {

      for (String[] completion :
          RegExpLanguageHosts.getInstance().getPosixCharacterClasses(parameters.getPosition())) {
        result.addElement(
            LookupElementBuilder.create(completion[0])
                .withTypeText((completion.length > 1) ? completion[1] : null)
                .withIcon(emptyIcon)
                .withInsertHandler(
                    new InsertHandler<LookupElement>() {
                      @Override
                      public void handleInsert(InsertionContext context, LookupElement item) {
                        context.setAddCompletionChar(false);
                        final Editor editor = context.getEditor();
                        final Document document = editor.getDocument();
                        final int tailOffset = context.getTailOffset();
                        if (document.getTextLength() < tailOffset + 2
                            || !document
                                .getText(new TextRange(tailOffset, tailOffset + 2))
                                .equals(":]")) {
                          document.insertString(tailOffset, ":]");
                        }
                        editor.getCaretModel().moveCaretRelatively(2, 0, false, false, true);
                      }
                    }));
      }
    }
  // Get closing tag
  private LookupElementBuilder reuseClosingTag(String name) {
    if (!CLOSING_LOOKUPS.containsKey(name)) {
      CLOSING_LOOKUPS.put(name, LookupElementBuilder.create(name));
    }

    return CLOSING_LOOKUPS.get(name);
  }
 private void addLanguageKeyword(CompletionResultSet resultSet, String text) {
   // TODO:: order most common used first
   String keywords =
       "|abs|accept|alarm|atan2|AUTOLOAD|BEGIN|bind|binmode|bless|break|caller|chdir|CHECK|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|cos|crypt|dbmclose|dbmopen|defined|delete|DESTROY|die|dump|each|END|endgrent|endhostent|endnetent|endprotoent|endpwent|endservent|eof|eval|exec|exists|exit|fcntl|fileno|flock|fork|format|formline|getc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|index|INIT|int|ioctl|join|keys|kill|last|lc|each|lcfirst|setnetent|length|link|listen|local|localtime|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|next|not|oct|open|opendir|ord|our|pack|pipe|pop|pos|print|printf|prototype|push|quotemeta|rand|read|readdir|readline|readlink|readpipe|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|say|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|each|lcfirst|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|state|study|substr|symlink|syscall|sysopen|sysread|sysseek|system|syswrite|tell|telldir|tie|tied|time|times|truncate|ucfirst|umask|undef|UNITCHECK|unlink|unpack|unshift|untie|use|utime|values|vec|wait|waitpid|wantarray|warn|write|each|lcfirst|setnetent|cmp|continue|CORE|else|elsif|exp|for|foreach|lock|package|unless|until|while|ARGV|ARGVOUT|STDERR|STDIN|STDOUT";
   Matcher matcher = Utils.applyRegex("\\|(" + text + "[^\\|]+)", keywords);
   while (matcher.find()) {
     resultSet.addElement(LookupElementBuilder.create(matcher.group(1)));
   }
 }
Example #12
0
  @Nullable
  public static LookupElementBuilder createPropertyLookupElement(
      @NotNull PsiMethod accessor,
      @Nullable GroovyResolveResult resolveResult,
      @Nullable PrefixMatcher matcher) {
    String propName;
    PsiType propType;
    final boolean getter = GroovyPropertyUtils.isSimplePropertyGetter(accessor, null);
    if (getter) {
      propName = GroovyPropertyUtils.getPropertyNameByGetter(accessor);
    } else if (GroovyPropertyUtils.isSimplePropertySetter(accessor, null)) {
      propName = GroovyPropertyUtils.getPropertyNameBySetter(accessor);
    } else {
      return null;
    }
    assert propName != null;
    if (!PsiUtil.isValidReferenceName(propName)) {
      propName = "'" + propName + "'";
    }

    if (matcher != null && !matcher.prefixMatches(propName)) {
      return null;
    }

    if (getter) {
      propType = PsiUtil.getSmartReturnType(accessor);
    } else {
      propType = accessor.getParameterList().getParameters()[0].getType();
    }

    final PsiType substituted =
        resolveResult != null ? resolveResult.getSubstitutor().substitute(propType) : propType;

    LookupElementBuilder builder =
        LookupElementBuilder.create(
                generatePropertyResolveResult(propName, accessor, propType, resolveResult),
                propName)
            .withIcon(JetgroovyIcons.Groovy.Property);
    if (substituted != null) {
      builder = builder.withTypeText(substituted.getPresentableText());
    }
    return builder;
  }
 @Override
 public Object[] getCompletionVariants(
     String completionPrefix, PsiElement location, ProcessingContext context) {
   List<Object> result = new ArrayList<Object>();
   Collections.addAll(result, super.getCompletionVariants(completionPrefix, location, context));
   for (String field : myFields) {
     result.add(LookupElementBuilder.create(field));
   }
   return ArrayUtil.toObjectArray(result);
 }
Example #14
0
 @Override
 public LookupElement[] calculateLookupItems(
     @NotNull Expression[] params, ExpressionContext context) {
   Object o = runIt(params, context);
   if (o != null) {
     Set<LookupElement> set = new LinkedHashSet<LookupElement>();
     set.add(LookupElementBuilder.create(o.toString()));
     return set.toArray(new LookupElement[set.size()]);
   }
   return LookupElement.EMPTY_ARRAY;
 }
 @Override
 public LookupElement[] calculateLookupItems(
     @NotNull Expression[] params, ExpressionContext context) {
   PsiNamedElement[] vars = getSupertypes(params, context);
   if (vars == null || vars.length < 2) return null;
   Set<LookupElement> set = new LinkedHashSet<LookupElement>();
   for (PsiNamedElement var : vars) {
     set.add(LookupElementBuilder.create(var));
   }
   return set.toArray(new LookupElement[set.size()]);
 }
  @NotNull
  @Override
  public Object[] getVariants() {

    List<LookupElement> lookupElements = new ArrayList<LookupElement>();
    for (String variant : this.variants) {
      lookupElements.add(LookupElementBuilder.create(variant));
    }

    return lookupElements.toArray();
  }
 private static LookupElement getSubLookupElementBuilder(Sub sub, boolean withArguments) {
   String text =
       (withArguments)
           ? sub.toString2(ConfigurationHolder.isHideFirstSelfArgument)
           : sub.getName();
   String containingPackage =
       sub.getPackageObj().getQualifiedName() + "(" + sub.getPackageObj().getFileName() + ")";
   return LookupElementBuilder.create(text)
       .withIcon(PerlIcons.SUBROUTINE)
       .withPresentableText(text)
       .withTypeText(containingPackage, true);
 }
 public void testIdentifiersInPlainDocstring() {
   final PyDocumentationSettings settings =
       PyDocumentationSettings.getInstance(myFixture.getModule());
   settings.setFormat(DocStringFormat.PLAIN);
   myFixture.configureByFile("completion/identifiersInPlainDocstring.py");
   final LookupElement[] elements = myFixture.completeBasic();
   assertNotNull(elements);
   assertContainsElements(
       Lists.newArrayList(elements),
       LookupElementBuilder.create("bar")
           .withAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE));
 }
 @Override
 public Object[] getVariants() {
   ArrayList<LookupElementBuilder> _xblockexpression = null;
   {
     ProgressIndicatorProvider.checkCanceled();
     ICrossReferenceDescription crossReferenceDescription = this.getCrossReferenceDescription();
     boolean _equals = Objects.equal(crossReferenceDescription, null);
     if (_equals) {
       return ((Object[])
           Conversions.unwrapArray(CollectionLiterals.<Object>emptyList(), Object.class));
     }
     ArrayList<LookupElementBuilder> variants =
         CollectionLiterals.<LookupElementBuilder>newArrayList();
     Iterable<IEObjectDescription> _variants = crossReferenceDescription.getVariants();
     for (final IEObjectDescription objectDescription : _variants) {
       {
         ProgressIndicatorProvider.checkCanceled();
         QualifiedName _name = objectDescription.getName();
         String name = this.qualifiedNameConverter.toString(_name);
         BaseXtextFile _xtextFile = this.myElement.getXtextFile();
         XtextResource _resource = _xtextFile.getResource();
         PsiElement element =
             this.psiModelAssociations.getPsiElement(objectDescription, _resource);
         boolean _notEquals = (!Objects.equal(element, null));
         if (_notEquals) {
           LookupElementBuilder _create = LookupElementBuilder.create(name);
           PsiElement _navigationElement = element.getNavigationElement();
           PsiFile _containingFile = _navigationElement.getContainingFile();
           String _name_1 = _containingFile.getName();
           LookupElementBuilder _withTypeText = _create.withTypeText(_name_1);
           variants.add(_withTypeText);
         }
       }
     }
     _xblockexpression = variants;
   }
   return ((Object[]) Conversions.unwrapArray(_xblockexpression, Object.class));
 }
  @Override
  public LookupElement[] calculateLookupItems(
      @NotNull Expression[] params, ExpressionContext context) {
    if (params.length == 0) return null;
    Set<LookupElement> set = new LinkedHashSet<>();

    for (Expression param : params) {
      Result object = param.calculateResult(context);
      if (object != null) {
        set.add(LookupElementBuilder.create(object.toString()));
      }
    }
    return set.toArray(new LookupElement[set.size()]);
  }
  @NotNull
  @Override
  public LookupElement[] getVariants() {
    final PsiElement element = getElement();
    if (!myStartTagFlag) {
      return super.getVariants();
    }
    final XmlTag xmlTag = (XmlTag) element;

    final List<XmlElementDescriptor> variants =
        TagNameReference.<XmlElementDescriptor>getTagNameVariants(
            xmlTag, Arrays.asList(xmlTag.knownNamespaces()), new ArrayList<String>(), Function.ID);
    final List<LookupElement> elements = new ArrayList<LookupElement>(variants.size());
    for (XmlElementDescriptor descriptor : variants) {
      final String descriptorName = descriptor.getName(element);
      if (descriptorName != null) {
        LookupElementBuilder lookupElement =
            LookupElementBuilder.create(descriptor, descriptorName);
        elements.add(lookupElement.withInsertHandler(JavaFxTagInsertHandler.INSTANCE));
      }
    }
    return elements.toArray(new LookupElement[elements.size()]);
  }
  private static LookupElementBuilder createGenerateMethodElement(
      PsiMethod prototype,
      PsiSubstitutor substitutor,
      Icon icon,
      String typeText,
      InsertHandler<LookupElement> insertHandler) {
    String methodName = prototype.getName();

    String visibility = VisibilityUtil.getVisibilityModifier(prototype.getModifierList());
    String modifiers = (visibility == PsiModifier.PACKAGE_LOCAL ? "" : visibility + " ");

    PsiType type = substitutor.substitute(prototype.getReturnType());
    String signature =
        modifiers + (type == null ? "" : type.getPresentableText() + " ") + methodName;

    String parameters =
        PsiFormatUtil.formatMethod(
            prototype, substitutor, PsiFormatUtilBase.SHOW_PARAMETERS, PsiFormatUtilBase.SHOW_NAME);

    String overrideSignature =
        " @Override "
            + signature; // leading space to make it a middle match, under all annotation
                         // suggestions
    LookupElementBuilder element =
        LookupElementBuilder.create(prototype, signature)
            .withLookupString(methodName)
            .withLookupString(signature)
            .withLookupString(overrideSignature)
            .withInsertHandler(insertHandler)
            .appendTailText(parameters, false)
            .appendTailText(" {...}", true)
            .withTypeText(typeText)
            .withIcon(icon);
    element.putUserData(GENERATE_ELEMENT, true);
    return element;
  }
  private static void addCompletionElements(
      CompletionResultSet result, final Consumer<Task> consumer, List<Task> items, int index) {
    final AutoCompletionPolicy completionPolicy =
        ApplicationManager.getApplication().isUnitTestMode()
            ? AutoCompletionPolicy.ALWAYS_AUTOCOMPLETE
            : AutoCompletionPolicy.NEVER_AUTOCOMPLETE;

    for (final Task task : items) {
      LookupElementBuilder builder =
          LookupElementBuilder.create(task, task.getId())
              .setIcon(task.getIcon())
              .addLookupString(task.getSummary())
              .setTailText(" " + task.getSummary(), true)
              .setInsertHandler(
                  new InsertHandler<LookupElement>() {
                    @Override
                    public void handleInsert(InsertionContext context, LookupElement item) {
                      Document document = context.getEditor().getDocument();
                      String s = task.getId() + ": " + task.getSummary();
                      document.replaceString(context.getStartOffset(), context.getTailOffset(), s);
                      context
                          .getEditor()
                          .getCaretModel()
                          .moveToOffset(context.getStartOffset() + s.length());
                      consumer.consume(task);
                    }
                  });
      if (task.isClosed()) {
        builder = builder.setStrikeout();
      }

      result.addElement(
          PrioritizedLookupElement.withGrouping(
              builder.withAutoCompletionPolicy(completionPolicy), index--));
    }
  }
  public void doTest(CompletionType type, int time, @Nullable String completeItem) {
    try {
      configureByFileNoComplete(getBeforeFileName());
      setType(type);

      complete(time);

      if (completeItem != null) {
        selectItem(LookupElementBuilder.create(completeItem), '\t');
      }

      checkResultByFile(getAfterFileName());
    } catch (Exception e) {
      throw new AssertionError(e);
    }
  }
  @NotNull
  @Override
  public Collection<LookupElement> getLookupElements(
      @NotNull SourceContributorParameter parameter) {
    String sourceParameter = parameter.getSourceParameter();
    if (sourceParameter == null) {
      return Collections.emptyList();
    }

    Collection<LookupElement> lookupElements = new ArrayList<LookupElement>();
    for (PhpClass phpClass :
        PhpIndex.getInstance(parameter.getProject()).getAllSubclasses(sourceParameter)) {
      lookupElements.add(
          LookupElementBuilder.create(phpClass.getPresentableFQN()).withIcon(phpClass.getIcon()));
    }

    return lookupElements;
  }
 @NotNull
 public Object[] getVariants() {
   final AntDomMacroDef parentMacrodef = getParentMacrodef();
   if (parentMacrodef != null) {
     final List variants = new ArrayList();
     for (AntDomMacrodefAttribute attribute : parentMacrodef.getMacroAttributes()) {
       final String attribName = attribute.getName().getStringValue();
       if (attribName != null && attribName.length() > 0) {
         final LookupElementBuilder builder = LookupElementBuilder.create(attribName);
         final LookupElement element =
             AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE.applyPolicy(builder);
         variants.add(element);
       }
     }
     return ContainerUtil.toArray(variants, new Object[variants.size()]);
   }
   return EMPTY_ARRAY;
 }
 private static LookupElement[] initLookupItems(
     LinkedHashSet<String> names, PsiNamedElement elementToRename, final boolean shouldSelectAll) {
   if (names == null) {
     names = new LinkedHashSet<String>();
     for (NameSuggestionProvider provider :
         Extensions.getExtensions(NameSuggestionProvider.EP_NAME)) {
       final SuggestedNameInfo suggestedNameInfo =
           provider.getSuggestedNames(elementToRename, elementToRename, names);
       if (suggestedNameInfo != null
           && provider instanceof PreferrableNameSuggestionProvider
           && !((PreferrableNameSuggestionProvider) provider).shouldCheckOthers()) {
         break;
       }
     }
   }
   final LookupElement[] lookupElements = new LookupElement[names.size()];
   final Iterator<String> iterator = names.iterator();
   for (int i = 0; i < lookupElements.length; i++) {
     final String suggestion = iterator.next();
     lookupElements[i] =
         LookupElementBuilder.create(suggestion)
             .withInsertHandler(
                 new InsertHandler<LookupElement>() {
                   @Override
                   public void handleInsert(InsertionContext context, LookupElement item) {
                     if (shouldSelectAll) return;
                     final Editor topLevelEditor =
                         InjectedLanguageUtil.getTopLevelEditor(context.getEditor());
                     final TemplateState templateState =
                         TemplateManagerImpl.getTemplateState(topLevelEditor);
                     if (templateState != null) {
                       final TextRange range = templateState.getCurrentVariableRange();
                       if (range != null) {
                         topLevelEditor
                             .getDocument()
                             .replaceString(
                                 range.getStartOffset(), range.getEndOffset(), suggestion);
                       }
                     }
                   }
                 });
   }
   return lookupElements;
 }
    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
      final Editor editor =
          PlatformDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext());
      assert editor != null;
      final TextRange textRange = ((ProblemDescriptorImpl) descriptor).getTextRange();
      editor.getSelectionModel().setSelection(textRange.getStartOffset(), textRange.getEndOffset());

      final String word = editor.getSelectionModel().getSelectedText();

      if (word == null || StringUtil.isEmptyOrSpaces(word)) {
        return;
      }
      final List<LookupElement> items = new ArrayList<LookupElement>();
      for (String variant : myUnboundParams) {
        items.add(LookupElementBuilder.create(variant));
      }
      LookupManager.getInstance(project)
          .showLookup(editor, items.toArray(new LookupElement[items.size()]));
    }
 public Object[] getCompletionVariants(
     String completionPrefix, PsiElement location, ProcessingContext context) {
   List<LookupElement> result = new ArrayList<LookupElement>();
   ScopeOwner scopeOwner = ScopeUtil.getScopeOwner(location);
   assert scopeOwner != null;
   final List<PyImportElement> importTargets = PyModuleType.getVisibleImports(scopeOwner);
   final int imported = myImportedModule.getImportedPrefix().getComponentCount();
   for (PyImportElement importTarget : importTargets) {
     final QualifiedName qName = importTarget.getImportedQName();
     if (qName != null && qName.matchesPrefix(myImportedModule.getImportedPrefix())) {
       final List<String> components = qName.getComponents();
       if (components.size() > imported) {
         String module = components.get(imported);
         result.add(LookupElementBuilder.create(module));
       }
     }
   }
   return result.toArray(new Object[result.size()]);
 }
  public void addCompletions(
      @NotNull final CompletionParameters parameters,
      final ProcessingContext context,
      @NotNull final CompletionResultSet result) {
    PsiElement element = parameters.getPosition();
    while (element != null && !(element instanceof CfmlAttributeImpl)) {
      element = element.getParent();
    }
    if (element == null) {
      return;
    }
    CfmlAttributeImpl attribute = (CfmlAttributeImpl) element;
    String attributeName = attribute.getFirstChild().getText();
    while (element != null && !(element instanceof CfmlTag)) {
      element = element.getParent();
    }
    if (element == null) {
      return;
    }
    CfmlTag tag = (CfmlTag) element;
    String tagName = tag.getTagName();

    String[] attributeValue =
        CfmlUtil.getAttributeValues(tagName, attributeName, parameters.getPosition().getProject());

    if ("type".equalsIgnoreCase(attributeName) && "cfargument".equalsIgnoreCase(tagName)
        || "returntype".equalsIgnoreCase(attributeName) && "cffunction".equalsIgnoreCase(tagName)) {
      Object[] objects =
          CfmlComponentReference.buildVariants(
              attribute.getPureAttributeValue(),
              element.getContainingFile(),
              element.getProject(),
              null,
              true);
      for (Object o : objects) {
        result.addElement((LookupElement) o);
      }
    }
    for (String s : attributeValue) {
      result.addElement(LookupElementBuilder.create(s).withCaseSensitivity(false));
    }
  }