public RncCompletionData() { declareFinalScope(RncElement.class); final CompletionVariant variant = new CompletionVariant(new AndFilter( new ElementFilter() { @Override public boolean isAcceptable(Object element, PsiElement context) { return true; } @Override public boolean isClassAcceptable(Class hintClass) { return PsiElement.class.isAssignableFrom(hintClass); } }, new PatternFilter(or( psiElement().afterLeaf(psiElement(RncTokenTypes.KEYWORD_DEFAULT)), not( or( psiElement().inside(psiElement(RncTokenTypes.LITERAL)), psiElement().afterLeaf(psiElement().withElementType(RncTokenTypes.KEYWORDS)) ) ) )) )); variant.includeScopeClass(LeafPsiElement.class, true); variant.addCompletion(new KeywordGetter()); registerVariant(variant); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[]{ "name" }, new PatternFilter(xmlAttributeValue().withParent(NAME_PATTERN)), true, new PrefixReferenceProvider()); // final XmlAttributeValuePattern id = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_REF_TYPE); // final XmlAttributeValuePattern idref = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_TYPE); // registry.registerXmlAttributeValueReferenceProvider(null, new PatternFilter(or(id, idref)), false, new IdRefProvider()); }
public RncCompletionData() { declareFinalScope(RncElement.class); final CompletionVariant variant = new CompletionVariant(new AndFilter( new ElementFilter() { public boolean isAcceptable(Object element, PsiElement context) { return true; } public boolean isClassAcceptable(Class hintClass) { return PsiElement.class.isAssignableFrom(hintClass); } }, new PatternFilter(or( psiElement().afterLeaf(psiElement(RncTokenTypes.KEYWORD_DEFAULT)), not( or( psiElement().inside(psiElement(RncTokenTypes.LITERAL)), psiElement().afterLeaf(psiElement().withElementType(RncTokenTypes.KEYWORDS)) ) ) )) )); variant.includeScopeClass(LeafPsiElement.class, true); variant.addCompletion(new KeywordGetter()); registerVariant(variant); }
@Override public void registerReferenceProviders(PsiReferenceRegistrar registrar) { XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[]{ "name" }, new PatternFilter(xmlAttributeValue().withParent(NAME_PATTERN)), true, new PrefixReferenceProvider()); // final XmlAttributeValuePattern id = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_REF_TYPE); // final XmlAttributeValuePattern idref = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_TYPE); // registry.registerXmlAttributeValueReferenceProvider(null, new PatternFilter(or(id, idref)), false, new IdRefProvider()); }
@Override public <T extends PsiMetaData> void registerMetaData(ElementPattern<?> pattern, Class<T> metadataDescriptorClass) { addMetadataBinding(new PatternFilter(pattern), metadataDescriptorClass); }
public CompletionVariant(Class scopeClass, ElementPattern position){ this(scopeClass, new PatternFilter(position)); }
public CompletionVariant(ElementPattern<? extends PsiElement> position){ this(new PatternFilter(position)); }