@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(PlatformPatterns.psiElement(YAMLScalar.class), new PsiReferenceProvider() { @NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { if (isConfigFile(element)) { String valueText = ((YAMLScalar) element).getTextValue(); List<MacroResolver.Match> matches = new MacroResolver().resolve(valueText); List<PsiReference> references = new ArrayList<>(); matches.stream() .filter(match -> !match.isEscaped()) .map(match -> resolvePsiReferences(element, match.getReference(), (element instanceof YAMLQuotedText ? 1 : 0) + match.getStartPos())) .forEach(references::addAll); return references.toArray(new PsiReference[references.size()]); } return PsiReference.EMPTY_ARRAY; } }); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class), new PsiReferenceProvider() { @NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { if (isLiteralOfConfigurationAnnotation(element) || isCoffigMethod(element)) { PsiLiteralExpression literalExpression = (PsiLiteralExpression) element; String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null; List<PsiReference> psiReferences = resolvePsiReferences(element, value, 1); return psiReferences.toArray(new PsiReference[psiReferences.size()]); } return PsiReference.EMPTY_ARRAY; } }); }
public PsiReferenceRegistrarImpl(final Language language) { myBindingCache = new ConcurrentFactoryMap<Class, ProviderBinding[]>() { @Nullable @Override protected ProviderBinding[] create(Class key) { List<ProviderBinding> result = ContainerUtil.newSmartList(); for (Class<?> bindingClass : myBindingsMap.keySet()) { if (bindingClass.isAssignableFrom(key)) { result.add(myBindingsMap.get(bindingClass)); } } for (Class<?> bindingClass : myNamedBindingsMap.keySet()) { if (bindingClass.isAssignableFrom(key)) { result.add(myNamedBindingsMap.get(bindingClass)); } } if (language != Language.ANY) { final PsiReferenceRegistrar anyRegistrar = ReferenceProvidersRegistry.getInstance().getRegistrar(Language.ANY); Collections.addAll(result, ((PsiReferenceRegistrarImpl)anyRegistrar).myBindingCache.get(key)); } //noinspection unchecked return result.toArray(new ProviderBinding[result.size()]); } }; }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar psiReferenceRegistrar) { // <service class="\Namespace\Interface" /> XmlAttributeValuePattern serviceTag = XmlHelper.getTagAttributeValuePattern( XmlHelper.SERVICE_TAG, XmlHelper.CLASS_ATTRIBUTE ); psiReferenceRegistrar.registerReferenceProvider( serviceTag, new XmlReferenceProvider(new ReferenceResultsFiller[]{ InterfacesResultsFiller.INSTANCE })); // <service method="MethodName"/> XmlAttributeValuePattern methodAttribute = XmlHelper.getMethodAttributePattern(); psiReferenceRegistrar.registerReferenceProvider( methodAttribute, new XmlReferenceProvider(new ReferenceResultsFiller[]{ new ServiceMethodResultsFiller() }) ); }
@Override public void registerReferenceProviders(PsiReferenceRegistrar registrar) { // references from same language registrar.registerReferenceProvider( PlatformPatterns.psiElement(KUserId.class).withLanguage(KLanguage.INSTANCE), new PsiReferenceProvider() { @NotNull @Override public PsiReference[] getReferencesByElement(PsiElement element, ProcessingContext context) { if (element instanceof KUserId) { final String key = element.getText(); return new PsiReference[]{new KReference((KUserId)element, new TextRange(0, key.length()))}; } return new PsiReference[0]; } } ); }
@Override public void registerReferenceProviders(PsiReferenceRegistrar registrar) { final XmlFilePattern.Capture filePattern = xmlFile().withName(string().oneOf("plugin.xml", "feature.xml", "site.xml")); registrar.registerReferenceProvider( XmlPatterns.xmlAttributeValue().inFile(filePattern).withValue(string().startsWith("%")), new PluginXmlPropertiesReferenceProvider() ); registrar.registerReferenceProvider( PlatformPatterns.psiElement(XmlToken.class).inside( xmlText().inside( xmlTag().inFile(filePattern) ) ).withText(string().startsWith("%")), new PluginXmlPropertiesReferenceProvider() ); }
@Override public void registerReferenceProviders(PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(StandardPatterns.instanceOf(PhpPsiElement.class), new YiiPsiReferenceProvider()); registrar.registerReferenceProvider( PlatformPatterns.psiElement(PsiElement.class).withParent(isParamListInMethodWithName(".+?widget\\(.+")) , new WidgetCallReferenceProvider()); //View-to-view registrar.registerReferenceProvider( PlatformPatterns.psiElement(PhpPsiElement.class) .withParent(isParamListInMethodWithName(".+?render(Partial)*\\(.+")) .andNot(inFile(PlatformPatterns.string().endsWith("Controller.php"))) , new ViewRenderViewReferenceProvider()); //Controller-to-view registrar.registerReferenceProvider( PlatformPatterns.psiElement(PhpPsiElement.class) .withParent(isParamListInMethodWithName("(?sim).+?render(Partial)*\\(.+")) .and(inFile(PlatformPatterns.string().endsWith("Controller.php"))) , new ControllerRenderViewReferenceProvider()); }
public void registerReferenceProviders(PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(psiElement(XmlAttributeValue.class).withParent(xmlAttribute().withLocalName("name", "href", "mode", "elements", "exclude-result-prefixes", "extension-element-prefixes", "stylesheet-prefix").withParent(xmlTag().withNamespace(XsltSupport.XSLT_NS))), new XsltReferenceProvider()); registrar.registerReferenceProvider(xmlAttributeValue().withValue(string().matches("[^()]+")).withParent(xmlAttribute("as").withParent(xmlTag().withNamespace(XsltSupport.XSLT_NS))), SchemaTypeProvider.INSTANCE); registrar.registerReferenceProvider(xmlAttributeValue().withParent(xmlAttribute("as").withParent(xmlTag().withNamespace(XsltSupport.XSLT_NS))).withValue(string().contains(":")), new PsiReferenceProvider() { @NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { return new PsiReference[]{new NamespacePrefixReference(element)}; } }); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { // ->dispatch("event_name") registrar.registerReferenceProvider( PhpPatternsHelper.STRING_METHOD_ARGUMENT, new EventDispatchReferenceProvider() ); }
@Override public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider( tagAttributeValuePattern("action", "bean", ITEMS_TYPE_FILE_NAME), new HybrisSpringProcessReferenceProvider() ); }
@Override public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider( tagAttributeValuePattern("transition", "to", ITEMS_TYPE_FILE_NAME), new HybrisTransitionProcessReferenceProvider() ); registrar.registerReferenceProvider( tagAttributeValuePattern("then", ITEMS_TYPE_FILE_NAME), new HybrisTransitionProcessReferenceProvider() ); }
@Override public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider( tagAttributeValuePattern("enumtype", "code", ITEMS_TYPE_FILE_NAME), new HybrisEnumItemReferenceProvider() ); registrar.registerReferenceProvider( tagAttributeValuePattern("value", "code", ITEMS_TYPE_FILE_NAME).inside(insideTagPattern("enumtype")), new HybrisEnumLiteralItemReferenceProvider() ); registrar.registerReferenceProvider( tagAttributeValuePattern("itemtype", "code", ITEMS_TYPE_FILE_NAME), new HybrisModelItemReferenceProvider() ); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider( PlatformPatterns.psiElement(YAMLKeyValue.class), new NodeTypeReferenceProvider() ); }
@Override public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_SCHEMAS_PREFIX), createLocalReferenceProvider()); registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_RESPONSES_PREFIX), createLocalReferenceProvider()); registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_PARAMETERS_PREFIX), createLocalReferenceProvider()); registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_EXAMPLES_PREFIX), createLocalReferenceProvider()); registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_REQUEST_BODIES_PREFIX), createLocalReferenceProvider()); registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_HEADERS_PREFIX), createLocalReferenceProvider()); registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_LINKS_PREFIX), createLocalReferenceProvider()); registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_CALLBACKS_PREFIX), createLocalReferenceProvider()); registrar.registerReferenceProvider(filePattern(), createFileReferenceProvider()); registrar.registerReferenceProvider(componentFileReferencePattern(), createComponentFileReferenceProvider()); }
@Override public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(localDefinitionsPattern(), createLocalReferenceProvider()); registrar.registerReferenceProvider(externalDefinitionsInRootPattern(), createExternalDefinitionsInRootReferenceProvider()); registrar.registerReferenceProvider(externalDefinitionsNotInRootPattern(), createExternalDefinitionsNotInRootReferenceProvider()); registrar.registerReferenceProvider(localParametersPattern(), createLocalReferenceProvider()); registrar.registerReferenceProvider(localResponsesPattern(), createLocalReferenceProvider()); registrar.registerReferenceProvider(filePattern(), createFileReferenceProvider()); registrar.registerReferenceProvider(tagsPattern(), createTagsReferenceProvider()); }
@Override public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { GenericValueReferenceProvider provider = new GenericValueReferenceProvider(); registrar.registerReferenceProvider(XmlPatterns.xmlTag(), provider); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue(), provider); }
@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 void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(ourTestClassPattern, new JavaClassReferenceProvider()); registrar.registerReferenceProvider(ourListenerClassPattern, new JavaClassReferenceProvider()); final JavaClassReferenceProvider methodSelectorProvider = new JavaClassReferenceProvider(); methodSelectorProvider.setOption(JavaClassReferenceProvider.EXTEND_CLASS_NAMES, new String[]{"org.testng.IMethodSelector"}); registrar.registerReferenceProvider(ourMethodSelectorPattern, methodSelectorProvider); registrar.registerReferenceProvider(ourSuiteFilePattern, new PathListReferenceProvider(){ @Override protected boolean disableNonSlashedPaths() { return false; } }); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { ElementPattern pattern = XmlPatterns.xmlTag().withParent(DomPatterns.tagWithDom("properties", DomPatterns.domElement(MavenDomProperties.class))); registrar.registerReferenceProvider(pattern, new MavenPropertyPsiReferenceProvider(), PsiReferenceRegistrar.DEFAULT_PRIORITY); registrar.registerReferenceProvider(PlatformPatterns.psiElement(), new MavenFilteredPropertyPsiReferenceProvider(), PsiReferenceRegistrar.DEFAULT_PRIORITY); }
@Override public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(PlatformPatterns.psiElement(GrLiteral.class), new PropertiesReferenceProvider()); registrar.registerReferenceProvider(GroovyPatterns.stringLiteral().withParent(GrAnnotationNameValuePair.class), new SpockUnrollReferenceProvider()); }
@Override public void registerReferenceProviders(PsiReferenceRegistrar registrar) { JavaClassReferenceProvider provider = new JavaClassReferenceProvider(); provider.setOption(JavaClassReferenceProvider.CLASS_KIND, ClassKind.CLASS); registrar.registerReferenceProvider( JavaClassQualifiedNameReference.PATTERN, new JavaClassReferenceProvider()); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { CndReferenceProvider cndReferenceProvider = new CndReferenceProvider(); registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class), cndReferenceProvider); //Java registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.SUPER_TYPE), cndReferenceProvider); //Cnd super types registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.EXTENSION), cndReferenceProvider); //Cnd extends types registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.SUB_NODE_TYPE), cndReferenceProvider); //Cnd subnode types registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.SUB_NODE_DEFAULT_TYPE), cndReferenceProvider); //Cnd subnode default type registrar.registerReferenceProvider(PlatformPatterns.psiElement(XmlElementType.XML_ATTRIBUTE_VALUE), cndReferenceProvider); //XML registrar.registerReferenceProvider(PlatformPatterns.psiElement(PropertiesTokenTypes.KEY_CHARACTERS), cndReferenceProvider); //Properties }
/** * {@inheritDoc} */ @Override public void registerReferenceProviders(final PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider( PlatformPatterns.psiElement(MetaborgReferenceElement.class), this.referenceProviderFactory.create() ); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider( psiElement(PyStringLiteralExpression.class), new PantsTargetPathReferenceProvider() ); }
@Override public void registerReferenceProviders(PsiReferenceRegistrar registrar) { PsiElementPattern.Capture<PsiNamedElement> variableCapture = PlatformPatterns.psiElement(PsiNamedElement.class).withParent(HaskellVars.class).withParent(HaskellGendecl.class).withLanguage(HaskellLanguage.INSTANCE); registrar.registerReferenceProvider(variableCapture, new HaskellReferenceProvider()); }
@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()); }
public void registerReferenceProviders(PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(ourTestClassPattern, new JavaClassReferenceProvider()); registrar.registerReferenceProvider(ourListenerClassPattern, new JavaClassReferenceProvider()); final JavaClassReferenceProvider methodSelectorProvider = new JavaClassReferenceProvider(); methodSelectorProvider.setOption(JavaClassReferenceProvider.EXTEND_CLASS_NAMES, new String[]{"org.testng.IMethodSelector"}); registrar.registerReferenceProvider(ourMethodSelectorPattern, methodSelectorProvider); registrar.registerReferenceProvider(ourSuiteFilePattern, new PathListReferenceProvider(){ @Override protected boolean disableNonSlashedPaths() { return false; } }); }
@Override public void registerReferenceProviders(PsiReferenceRegistrar registrar) { ElementPattern pattern = XmlPatterns.xmlTag().withParent(DomPatterns.withDom(DomPatterns.domElement(MavenDomProperties.class))); registrar.registerReferenceProvider(pattern, new MavenPropertyPsiReferenceProvider(), PsiReferenceRegistrar.DEFAULT_PRIORITY); registrar.registerReferenceProvider(PlatformPatterns.psiElement(), new MavenFilteredPropertyPsiReferenceProvider(), PsiReferenceRegistrar.DEFAULT_PRIORITY); }
@Override public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) { XmlUtil.registerXmlAttributeValueReferenceProvider(psiReferenceRegistrar, new String[]{"id"}, null, false, new HtmlIdOrClassToCssFileReferenceProvider(XStyleSheetSimpleSelectorType.ID)); XmlUtil.registerXmlAttributeValueReferenceProvider(psiReferenceRegistrar, new String[]{"class"}, null, false, new HtmlIdOrClassToCssFileReferenceProvider(XStyleSheetSimpleSelectorType.CLASS)); HtmlHrefToCssFileReferenceProvider provider = new HtmlHrefToCssFileReferenceProvider(); XmlUtil.registerXmlAttributeValueReferenceProvider(psiReferenceRegistrar, new String[]{"href"}, provider.getElementFilter(), false, provider); }
private void registerExternalMacroLibraryProvider(PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(VTLMACROLIBRARY_COMMENT, new PsiReferenceProvider() { @NotNull public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) { final List<PsiReference> result = new SmartList<PsiReference>(); if (findAndAddReferencesByElement(element, "path=\"", "\"", result)) { findAndAddReferencesByElement(element, "file=\"", "\"", result); } return result.toArray(PsiReference.EMPTY_ARRAY); } }); }
private void registerVelocityPropertiesProvider(PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(VELOCITY_PROPERTIES_COMMENT, new PsiReferenceProvider() { @NotNull public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) { final List<PsiReference> result = new SmartList<PsiReference>(); if (findAndAddReferencesByElement(element, "path=\"", "\"", result)) { findAndAddReferencesByElement(element, "runtime_root=\"", "\"", result); findAndAddReferencesByElement(element, "file=\"", "\"", result); } return result.toArray(PsiReference.EMPTY_ARRAY); } }); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar psiReferenceRegistrar) { psiReferenceRegistrar.registerReferenceProvider(ElementPattern(), new PsiReferenceProvider()); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar psiReferenceRegistrar) { psiReferenceRegistrar.registerReferenceProvider(ElementPattern(), new ObjectFactoryReferenceProvider()); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(psiElement() .withText(string().startsWith(INCLUDE_TAG)) , new IncludeFilePathReferenceProvider()); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(PATTERN, new JavaReflectionReferenceProvider()); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiComment.class), COMMENTS_REFERENCE_PROVIDER_TYPE.getProvider()); }
@Override public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(DocStringTagCompletionContributor.DOCSTRING_PATTERN, new DocStringReferenceProvider()); }