类 com.intellij.codeInsight.completion.XmlTagInsertHandler 源码实例Demo

下面列出了怎么用 com.intellij.codeInsight.completion.XmlTagInsertHandler 的API类实例代码及写法,或者点击链接到github查看源代码。


@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;
}