Package com.intellij.codeInsight.lookup

Examples of com.intellij.codeInsight.lookup.LookupElement


    final LookupEx activeLookup = LookupManager.getActiveLookup(editor);
    if ((activeLookup != null) && activeLookup.isFocused()) {
      final PsiElement elementAt = file.findElementAt(editor.getCaretModel().getOffset() - 1);
      if (elementAt != null) {
        Symbol lookup = new SymbolImpl(elementAt.getNode());
        final LookupElement currentItem = activeLookup.getCurrentItem();
        final String lookupString = currentItem != null ? currentItem.getLookupString() : "";
        lookup.setName(lookupString);
        return lookup;
      }
    }
View Full Code Here


    final LookupEx lookup = LookupManager.getActiveLookup(myFixture.getEditor());
    assertFalse(toComplete != null && lookup == null);
    if (lookup != null && toComplete != null) {
      final LookupElement[] elements = myFixture.getLookupElements();
      assertNotNull("no lookups", elements);
      final LookupElement element = ContainerUtil.find(elements, new Condition<LookupElement>() {
        @Override
        public boolean value(LookupElement element) {
          return StringUtil.equals(element.getLookupString(), toComplete);
        }
      });
      assertNotNull("Can't find '" + toComplete + "' variant", element);
      lookup.setCurrentItem(element);
    }
View Full Code Here

  private static void addKeywordsToResult(final Collection<String> keywords,
                                          final CompletionResultSet result,
                                          final boolean withColonSuffix, int priority, boolean withSpace) {
    for (String keyword : keywords) {
      LookupElement element = createKeywordLookupElement(withColonSuffix ? keyword + ":" : keyword, withSpace);

      result.addElement(PrioritizedLookupElement.withPriority(element, priority));
    }
  }
View Full Code Here

      result.addElement(PrioritizedLookupElement.withPriority(element, priority));
    }
  }

  private static LookupElement createKeywordLookupElement(final String keyword, boolean withSpace) {
    LookupElement result = LookupElementBuilder.create(keyword);
    if (ApplicationManager.getApplication().isUnitTestMode()) {
      result = ((LookupElementBuilder)result).withAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE);
    }
    if (withSpace) {
      result = TailTypeDecorator.withTail(result, TailType.SPACE);
View Full Code Here

    public Object[] getVariants() {
      final Collection<String> controllers = AngularIndexUtil.getAllKeys(AngularControllerIndex.INDEX_ID, getElement().getProject());
      final LookupElement[] result = new LookupElement[controllers.size()];
      int i = 0;
      for (String controller : controllers) {
        final LookupElement item = JSLookupUtilImpl.createPrioritizedLookupItem(null, controller,
                                                                                VariantsProcessor.LookupPriority.LOCAL_SCOPE_MAX_PRIORITY,
                                                                                false, false);
        result[i] = item;
        i++;
      }
View Full Code Here

    assertNotNull(context);

    myFixture.completeBasic();
    LookupElement[] elements = myFixture.getLookupElements();
    assertNotNull(elements);
    LookupElement lookupElement = ContainerUtil.find(elements, new Condition<LookupElement>() {
      @Override
      public boolean value(LookupElement element) {
        return element.getAllLookupStrings().contains("ng-controller");
      }
    });
    assertNotNull(lookupElement);

    DocumentationProvider documentationProvider = DocumentationManager.getProviderFromElement(context);
    PsiElement docElement = documentationProvider.getDocumentationElementForLookupItem(getPsiManager(), lookupElement.getObject(), context);
    assertNotNull(docElement);
    assertDocumentation(docElement, context);
  }
View Full Code Here

  private void doTest() {
    final String testName = getTestName(true);
    myFixture.configureByFile(testName + ".feature");
    LookupElement[] result = myFixture.completeBasic();

    LookupElement scenarioOutlineLookupElement = null;
    for (LookupElement lookupElement : result) {
      if (lookupElement.getUserDataString().contains("Scenario")) {
        scenarioOutlineLookupElement = lookupElement;
        break;
      }
View Full Code Here

TOP

Related Classes of com.intellij.codeInsight.lookup.LookupElement

Copyright © 2018 www.massapicom. 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.