com.intellij.codeInsight.completion.XmlTagInsertHandler Java Examples

The following examples show how to use com.intellij.codeInsight.completion.XmlTagInsertHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ViewHelperUtil.java    From idea-php-typo3-plugin with MIT License 6 votes vote down vote up
@NotNull
public static Collection<LookupElement> tagNameVariantsLookupElementsForCurrentPosition(@NotNull Project project, @NotNull PsiElement tag, String prefix) {
    List<LookupElement> elements = new ArrayList<>();

    findAllViewHelpersInContextByName(project, tag)
        .forEach((name, vh) -> elements.add(
            LookupElementBuilder
                .create((prefix == null || prefix.isEmpty()) ? name : vh.name)
                .withIcon(FluidIcons.TYPO3)
                .withTypeText(vh.getDocumentation())
                .withPresentableText(name)
                .withInsertHandler(XmlTagInsertHandler.INSTANCE))
        );

    return elements;
}