use of com.intellij.psi.PsiElementResolveResult in project intellij-community by JetBrains.
the class PyTargetReference method multiResolve.
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
final ResolveResult[] results = super.multiResolve(incompleteCode);
boolean shadowed = false;
for (ResolveResult result : results) {
final PsiElement element = result.getElement();
if (element != null && (element.getContainingFile() != myElement.getContainingFile() || element instanceof PyFunction || element instanceof PyClass)) {
shadowed = true;
break;
}
}
if (results.length > 0 && !shadowed) {
return results;
}
// resolve to self if no other target found
return new ResolveResult[] { new PsiElementResolveResult(myElement) };
}
use of com.intellij.psi.PsiElementResolveResult in project intellij-elixir by KronicDeth.
the class For method execute.
/*
* Private Instance Methods
*/
private boolean execute(@NotNull Call call, @NotNull @SuppressWarnings("unused") ResolveState state) {
boolean keepProcessing = true;
if (org.elixir_lang.structure_view.element.modular.Implementation.is(call)) {
PsiElement element = org.elixir_lang.structure_view.element.modular.Implementation.forNameElement(call);
boolean validResult;
if (element != null) {
validResult = this.validResult;
} else {
Call enclosingModularMacroCall = enclosingModularMacroCall(call);
if (enclosingModularMacroCall != null) {
if (enclosingModularMacroCall.isCalling(KERNEL, DEFMODULE)) {
element = Module.nameIdentifier(enclosingModularMacroCall);
validResult = this.validResult;
} else {
element = enclosingModularMacroCall;
validResult = false;
}
} else {
element = call;
validResult = false;
}
}
resolveResultList = Collections.<ResolveResult>singletonList(new PsiElementResolveResult(element, validResult));
keepProcessing = false;
}
return keepProcessing;
}
use of com.intellij.psi.PsiElementResolveResult in project intellij-elixir by KronicDeth.
the class Protocol method execute.
/*
* Private Instance Methods
*/
private boolean execute(@NotNull Call call, @NotNull @SuppressWarnings("unused") ResolveState state) {
boolean keepProcessing = true;
if (org.elixir_lang.structure_view.element.modular.Implementation.is(call)) {
QualifiableAlias protocolNameElement = org.elixir_lang.structure_view.element.modular.Implementation.protocolNameElement(call);
PsiElement element;
boolean validResult;
if (protocolNameElement != null) {
element = protocolNameElement;
validResult = this.validResult;
} else {
element = call;
validResult = false;
}
resolveResultList = Collections.<ResolveResult>singletonList(new PsiElementResolveResult(element, validResult));
keepProcessing = false;
}
return keepProcessing;
}
use of com.intellij.psi.PsiElementResolveResult in project intellij-plugins by JetBrains.
the class CfmlArgumentNameReference method resolveInner.
@NotNull
@Override
protected ResolveResult[] resolveInner() {
PsiElement nextSibling = getNextSibling();
while (nextSibling instanceof PsiWhiteSpace) {
nextSibling = nextSibling.getNextSibling();
}
if (nextSibling != null && nextSibling.getNode().getElementType() != CfmlTokenTypes.ASSIGN) {
return super.resolveInner();
}
CfmlParameter[] functionParameters = getFunctionParameters();
if (functionParameters != null) {
Collection<ResolveResult> result = new LinkedList<>();
String referenceName = getReferenceName();
for (CfmlParameter param : functionParameters) {
if (referenceName.equals(param.getName())) {
result.add(new PsiElementResolveResult(param));
}
}
return result.toArray(ResolveResult.EMPTY_ARRAY);
}
return ResolveResult.EMPTY_ARRAY;
}
use of com.intellij.psi.PsiElementResolveResult in project Perl5-IDEA by Camelcade.
the class PodLinkToFileReference method resolveInner.
@NotNull
@Override
protected ResolveResult[] resolveInner(boolean incompleteCode) {
PodFormatterL podLink = getElement();
PodLinkDescriptor descriptor = podLink.getLinkDescriptor();
if (descriptor != null && !descriptor.isUrl() && descriptor.getFileId() != null) {
PsiFile targetFile = PodFileUtil.getPodOrPackagePsiByDescriptor(podLink.getProject(), descriptor);
if (targetFile != null) {
return new ResolveResult[] { new PsiElementResolveResult(targetFile) };
}
}
return ResolveResult.EMPTY_ARRAY;
}
Aggregations