use of ool.intellij.plugin.psi.MacroName in project oxy-template-support-plugin by mutant-industries.
the class OxyTemplatePsiUtil method isClosingTagMacroName.
public static boolean isClosingTagMacroName(@NotNull final MacroName macroName) {
if (PsiTreeUtil.getParentOfType(macroName, MacroEmptyTag.class) != null) {
return false;
}
MacroCall tag = PsiTreeUtil.getParentOfType(macroName, MacroCall.class);
MacroName openingTagMacroName;
return tag != null && (openingTagMacroName = tag.getMacroName()) != null && !openingTagMacroName.isEquivalentTo(macroName);
}
use of ool.intellij.plugin.psi.MacroName in project oxy-template-support-plugin by mutant-industries.
the class UnclosedMacroTag method fillCompletionVariants.
@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
MacroName elementAt;
if (parameters.getPosition().getNode().getElementType() != OxyTemplateTypes.T_MACRO_NAME || (elementAt = PsiTreeUtil.getParentOfType(parameters.getPosition(), MacroName.class)) == null || elementAt.getPrevSibling().getPrevSibling().getNode().getElementType() != OxyTemplateTypes.T_XML_CLOSE_TAG_START) {
return;
}
String macroTagToBeClosedName = OxyTemplateHelper.getPreviousUnclosedMacroTagName(elementAt.getPrevSibling());
if (macroTagToBeClosedName != null) {
result.withPrefixMatcher(new CamelHumpMatcher(elementAt.getText().replace(CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED, ""))).consume(LookupElementBuilder.create(macroTagToBeClosedName + ">").withPresentableText("m:" + macroTagToBeClosedName).withInsertHandler(new TrailingPatternConsumer(INSERT_CONSUME)).withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE));
}
}
Aggregations