@Test public void renderElement() { LookupElement testDelegate = new TestLookupElement(""); Template testTemplate = new TestTemplate("beforeDot.afterDot.afterDot"); LookupElementPresentation testPresentation = new TestLookupElementPresentation(); testPresentation.setTailText("oldTail"); new MethodChainLookupElement(testDelegate, testTemplate).renderElement(testPresentation); assertEquals("oldTail.afterDot.afterDot", testPresentation.getTailText()); }
@Override public void renderElement(LookupElementPresentation presentation) { super.renderElement(presentation); String tail = fromTemplate.getTemplateText(); int secondMethodIndex = tail.indexOf('.'); if (secondMethodIndex > 0) { String substring = tail.substring(secondMethodIndex).replaceAll("[^A-Za-z0-9$_.()]+", ""); presentation.appendTailText(substring, true); } }
MethodChainLookupElement extends LookupElementDecorator<LookupElement> { @Override public void renderElement(LookupElementPresentation presentation) { super.renderElement(presentation); String tail = fromTemplate.getTemplateText(); int secondMethodIndex = tail.indexOf('.'); if (secondMethodIndex > 0) { String substring = tail.substring(secondMethodIndex).replaceAll("[^A-Za-z0-9$_.()]+", ""); presentation.appendTailText(substring, true); } } }
MethodChainLookupElement extends LookupElementDecorator<LookupElement> { @Override public void renderElement(LookupElementPresentation presentation) { super.renderElement(presentation); String tail = fromTemplate.getTemplateText(); int secondMethodIndex = tail.indexOf('.'); if (secondMethodIndex > 0) { String substring = tail.substring(secondMethodIndex).replaceAll("[^A-Za-z0-9$_.()]+", ""); presentation.appendTailText(substring, true); } } @VisibleForTesting  MethodChainLookupElement(LookupElement delegate, Template fromTemplate); }
MethodChainLookupElement extends LookupElementDecorator<LookupElement> { @Override public void renderElement(LookupElementPresentation presentation) { super.renderElement(presentation); String tail = fromTemplate.getTemplateText(); int secondMethodIndex = tail.indexOf('.'); if (secondMethodIndex > 0) { String substring = tail.substring(secondMethodIndex).replaceAll("[^A-Za-z0-9$_.()]+", ""); presentation.appendTailText(substring, true); } } @VisibleForTesting  MethodChainLookupElement(LookupElement delegate, Template fromTemplate); static LookupElement create(
      LookupElement lookupPresentation,
      String firstMethodName,
      List<? extends String> otherMethodNames,
      PsiElement placeholder,
      Project project); @Override void handleInsert(InsertionContext context); @Override void renderElement(LookupElementPresentation presentation); }
MethodChainLookupElement extends LookupElementDecorator<LookupElement> { @Override public void renderElement(LookupElementPresentation presentation) { super.renderElement(presentation); String tail = fromTemplate.getTemplateText(); int secondMethodIndex = tail.indexOf('.'); if (secondMethodIndex > 0) { String substring = tail.substring(secondMethodIndex).replaceAll("[^A-Za-z0-9$_.()]+", ""); presentation.appendTailText(substring, true); } } @VisibleForTesting  MethodChainLookupElement(LookupElement delegate, Template fromTemplate); static LookupElement create(
      LookupElement lookupPresentation,
      String firstMethodName,
      List<? extends String> otherMethodNames,
      PsiElement placeholder,
      Project project); @Override void handleInsert(InsertionContext context); @Override void renderElement(LookupElementPresentation presentation);  }