mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
devkit: more precise pattern
This commit is contained in:
@@ -26,6 +26,7 @@ import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.PsiReferenceProvider;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlAttributeValue;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -57,8 +58,8 @@ public class InspectionsKeyPropertiesReferenceProvider extends PsiReferenceProvi
|
||||
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
|
||||
boolean soft = myDefaultSoft;
|
||||
|
||||
if (element instanceof XmlAttribute) {
|
||||
final XmlAttribute xmlAttribute = (XmlAttribute)element;
|
||||
if (element instanceof XmlAttributeValue) {
|
||||
final XmlAttribute xmlAttribute = (XmlAttribute)element.getParent();
|
||||
if (element.getTextLength() < 2) {
|
||||
return PsiReference.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,11 @@ import com.intellij.psi.PsiReferenceRegistrar;
|
||||
public class InspectionsPropertiesReferenceProviderContributor extends PsiReferenceContributor {
|
||||
@Override
|
||||
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
|
||||
ElementPattern pattern = XmlPatterns.xmlAttribute().withParent(StandardPatterns.or(XmlPatterns.xmlTag().withName("localInspection"), XmlPatterns.xmlTag().withName("globalInspection")));
|
||||
ElementPattern pattern = XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute()
|
||||
.withParent(StandardPatterns.or(XmlPatterns.xmlTag().withName("localInspection")
|
||||
.withSuperParent(2, XmlPatterns.xmlTag().withName("idea-plugin")),
|
||||
XmlPatterns.xmlTag().withName("globalInspection")
|
||||
.withSuperParent(2, XmlPatterns.xmlTag().withName("idea-plugin")))));
|
||||
registrar.registerReferenceProvider(pattern, new InspectionsKeyPropertiesReferenceProvider(false), PsiReferenceRegistrar.DEFAULT_PRIORITY);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user