public void testIssue457EqualName() { String name = "foo"; LookupElement lookupElement = lookupElement(name); LookupElementPresentation lookupElementPresentation = new LookupElementPresentation(); lookupElement.renderElement(lookupElementPresentation); assertEquals(name, lookupElementPresentation.getItemText()); }
public void testIssue457ShorterName() { String name = "fo"; LookupElement lookupElement = lookupElement(name); LookupElementPresentation lookupElementPresentation = new LookupElementPresentation(); lookupElement.renderElement(lookupElementPresentation); assertEquals(name, lookupElementPresentation.getItemText()); }
public void testIssue457LongerNameIssue503() { String name = "fooo"; LookupElement lookupElement = lookupElement(name); LookupElementPresentation lookupElementPresentation = new LookupElementPresentation(); lookupElement.renderElement(lookupElementPresentation); assertEquals(name, lookupElementPresentation.getItemText()); }
@Override public void renderElement(LookupElementPresentation presentation) { lookupElement.renderElement(presentation); } }
public void testPointerSpecType() { myFixture.configureByText("foo.go", "package main; type a struct{};" + "func main() {q1, q2:=&a{};q<caret>}"); myFixture.completeBasic(); LookupElement first = ArrayUtil.getFirstElement(myFixture.getLookupElements()); assertNotNull(first); LookupElementPresentation presentation = new LookupElementPresentation(); first.renderElement(presentation); assertEquals("*main.a", presentation.getTypeText()); }
@Override public boolean match(@NotNull LookupElement lookupElement) { LookupElementPresentation presentation = new LookupElementPresentation(); lookupElement.renderElement(presentation); return presentation.getIcon() == this.icon; } }
@Override public void renderElement(LookupElementPresentation presentation) { presentation.setItemText(phpClass.getName()); presentation.setTypeText(phpClass.getPresentableFQN()); presentation.setTypeGrayed(true); super.renderElement(presentation); }
@Override public void renderElement(LookupElementPresentation presentation) { super.renderElement(presentation); presentation.setItemTextBold(withBoldness); presentation.setIcon(Symfony2Icons.DOCTRINE); presentation.setTypeGrayed(true); if(this.doctrineModelField.getTypeName() != null) { presentation.setTypeText(this.doctrineModelField.getTypeName()); } if(this.doctrineModelField.getRelationType() != null) { presentation.setTailText(String.format("(%s)", this.doctrineModelField.getRelationType()), true); } if(this.doctrineModelField.getRelation() != null) { presentation.setTypeText(this.doctrineModelField.getRelation()); presentation.setIcon(PhpIcons.CLASS_ICON); } }
public void assertCompletionLookupTailEquals(LanguageFileType languageFileType, String configureByText, String lookupString, String tailText) { myFixture.configureByText(languageFileType, configureByText); myFixture.completeBasic(); for (LookupElement lookupElement : myFixture.getLookupElements()) { if(!lookupElement.getLookupString().equals(lookupString)) { continue; } LookupElementPresentation presentation = new LookupElementPresentation(); lookupElement.renderElement(presentation); if(presentation.getTailText() == null) { fail(String.format("failed to check '%s'", lookupString)); } if(!presentation.getTailText().equals(tailText)) { fail(String.format("failed that on '%s' '%s' is equal '%s'", lookupString, tailText, presentation.getTailText())); } return; } fail(String.format("failed to check '%s' because it's unknown", lookupString)); }
/** * @see EventDispatcherSubscriberUtil#getEventNameLookupElements */ public void testGetEventNameLookupElementsForEventAnnotations() { Collection<LookupElement> eventNameLookupElements = EventDispatcherSubscriberUtil.getEventNameLookupElements(getProject()); ContainerUtil.find(eventNameLookupElements, lookupElement -> lookupElement.getLookupString().equals("bar.pre_bar") ); ContainerUtil.find(eventNameLookupElements, lookupElement -> lookupElement.getLookupString().equals("bar.post_bar") ); ContainerUtil.find(eventNameLookupElements, lookupElement -> { if(!"bar.post_bar".equals(lookupElement.getLookupString())) { return false; } LookupElementPresentation lookupElementPresentation = new LookupElementPresentation(); lookupElement.renderElement(lookupElementPresentation); return "My\\MyFooEvent".equals(lookupElementPresentation.getTypeText()); }); }
public void assertCompletionLookupContainsPresentableItem(LanguageFileType languageFileType, String configureByText, LookupElementPresentationAssert.Assert presentationAssert) { myFixture.configureByText(languageFileType, configureByText); myFixture.completeBasic(); LookupElement[] lookupElements = myFixture.getLookupElements(); if(lookupElements == null) { fail("failed to find lookup presentable on empty collection"); } for (LookupElement lookupElement : lookupElements) { LookupElementPresentation presentation = new LookupElementPresentation(); lookupElement.renderElement(presentation); if(presentationAssert.match(presentation)) { return; } } fail("failed to find lookup presentable"); }
public LookupElementPresentation getCompletionLookupElement(LanguageFileType languageFileType, String configureByText, String lookupString) { myFixture.configureByText(languageFileType, configureByText); myFixture.completeBasic(); for (LookupElement lookupElement : myFixture.getLookupElements()) { if(!lookupElement.getLookupString().equals(lookupString)) { continue; } LookupElementPresentation presentation = new LookupElementPresentation(); lookupElement.renderElement(presentation); return presentation; } fail(String.format("failed to to find lookup element '%s'", lookupString)); return null; }
StringBuilder sb = new StringBuilder(); LookupElementPresentation presentation = new LookupElementPresentation(); lookupElement.renderElement(presentation);
public void assertCompletionLookupTailEquals(LanguageFileType languageFileType, String configureByText, String lookupString, String tailText) { myFixture.configureByText(languageFileType, configureByText); myFixture.completeBasic(); for (LookupElement lookupElement : myFixture.getLookupElements()) { if(!lookupElement.getLookupString().equals(lookupString)) { continue; } LookupElementPresentation presentation = new LookupElementPresentation(); lookupElement.renderElement(presentation); if(presentation.getTailText() == null) { fail(String.format("failed to check '%s'", lookupString)); } if(!presentation.getTailText().equals(tailText)) { fail(String.format("failed that on '%s' '%s' is equal '%s'", lookupString, tailText, presentation.getTailText())); } return; } fail(String.format("failed to check '%s' because it's unknown", lookupString)); }