use of com.intellij.psi.PsiElementResolveResult in project Perl5-IDEA by Camelcade.
the class PerlMooseSuperReference method resolveInner.
@NotNull
@Override
protected ResolveResult[] resolveInner(boolean incompleteCode) {
// fixme not really dry with simpleresolver and superresolver. Need some generics magic
List<ResolveResult> result = new ArrayList<>();
PsiElement element = getElement();
PerlMooseOverrideStatement overrideStatement = PsiTreeUtil.getParentOfType(element, PerlMooseOverrideStatement.class);
if (overrideStatement != null) {
String packageName = PerlPackageUtil.getContextPackageName(element);
String subName = overrideStatement.getSubName();
Project project = element.getProject();
for (PsiElement targetElement : PerlMro.resolveSub(project, packageName, subName, true)) {
result.add(new PsiElementResolveResult(targetElement));
}
}
return result.toArray(new ResolveResult[result.size()]);
}
use of com.intellij.psi.PsiElementResolveResult in project Perl5-IDEA by Camelcade.
the class PerlNamespaceFileReference method resolveInner.
@NotNull
@Override
protected ResolveResult[] resolveInner(boolean incompleteCode) {
PerlNamespaceElement myElement = getElement();
PsiFile file = myElement.getContainingFile();
PsiFile targetFile;
targetFile = PerlPackageUtil.resolvePackageNameToPsi(file, getPackageName());
return targetFile == null ? ResolveResult.EMPTY_ARRAY : new ResolveResult[] { new PsiElementResolveResult(targetFile) };
}
use of com.intellij.psi.PsiElementResolveResult in project intellij-community by JetBrains.
the class TemplateReference method multiResolve.
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
final PsiElement element = resolve();
if (element != null) {
return new ResolveResult[] { new PsiElementResolveResult(element) };
}
final XmlFile xmlFile = (XmlFile) getElement().getContainingFile();
if (xmlFile != null) {
final List<PsiElementResolveResult> targets = new SmartList<>();
XsltIncludeIndex.processBackwardDependencies(xmlFile, xmlFile1 -> {
final PsiElement e = ResolveUtil.resolve(new NamedTemplateMatcher(xmlFile1.getDocument(), myName));
if (e != null) {
targets.add(new PsiElementResolveResult(e));
}
return true;
});
return targets.toArray(new ResolveResult[targets.size()]);
} else {
return ResolveResult.EMPTY_ARRAY;
}
}
use of com.intellij.psi.PsiElementResolveResult in project oxy-template-support-plugin by mutant-industries.
the class MacroReferenceResolver method resolve.
@NotNull
@Override
public ResolveResult[] resolve(@NotNull PsiPolyVariantReference ref, @NotNull PsiFile containingFile, boolean incompleteCode) {
String elementText = ref.getElement().getText();
String macroName = elementText.substring(elementText.indexOf('\"') + 1, ref.getRangeInElement().getEndOffset());
Project project = ref.getElement().getProject();
String normalizedMacroName = MacroIndex.normalizeMacroName(macroName);
List<PsiElement> references = new ArrayList<>();
if (resolveJsMacros) {
addJsMacroReferences(references, normalizedMacroName, ref.getElement(), project);
}
if (resolveJavaMacros) {
addJavaMacroReferences(references, normalizedMacroName, project);
}
ResolveResult[] resolveResults = new ResolveResult[references.size()];
for (int i = 0; i < references.size(); i++) {
resolveResults[i] = new PsiElementResolveResult(references.get(i));
}
return resolveResults;
}
use of com.intellij.psi.PsiElementResolveResult in project intellij-elixir by KronicDeth.
the class Exact method resolve.
@Override
public ResolveResult[] resolve(@NotNull Project project) {
List<ResolveResult> resolveResultList = new ArrayList<>();
forEachNavigationElement(project, name, navigationElement -> {
resolveResultList.add(new PsiElementResolveResult(navigationElement));
return true;
});
return resolveResultList.toArray(new ResolveResult[resolveResultList.size()]);
}
Aggregations