use of org.ballerinalang.plugins.idea.psi.IdentifierPSINode in project ballerina by ballerina-lang.
the class StructReference method resolveInPackage.
@Nullable
private PsiElement resolveInPackage(PackageNameNode packageNameNode) {
PsiElement resolvedElement = BallerinaPsiImplUtil.resolvePackage(packageNameNode);
if (resolvedElement == null || !(resolvedElement instanceof PsiDirectory)) {
return null;
}
PsiDirectory psiDirectory = (PsiDirectory) resolvedElement;
IdentifierPSINode identifier = getElement();
return BallerinaPsiImplUtil.resolveElementInPackage(psiDirectory, identifier, false, false, true, false, false, false, false, false);
}
use of org.ballerinalang.plugins.idea.psi.IdentifierPSINode in project ballerina by ballerina-lang.
the class StructReference method resolveInCurrentPackage.
@Nullable
private PsiElement resolveInCurrentPackage() {
IdentifierPSINode identifier = getElement();
PsiFile containingFile = identifier.getContainingFile();
if (containingFile == null) {
return null;
}
PsiFile originalFile = containingFile.getOriginalFile();
PsiDirectory psiDirectory = originalFile.getParent();
if (psiDirectory == null) {
return null;
}
return BallerinaPsiImplUtil.resolveElementInPackage(psiDirectory, identifier, false, false, true, false, false, false, true, true);
}
use of org.ballerinalang.plugins.idea.psi.IdentifierPSINode in project ballerina by ballerina-lang.
the class TypeReference method getVariants.
@NotNull
public static Object[] getVariants(PsiElement typeNameNode) {
String valueTypeName = typeNameNode.getText();
Project project = typeNameNode.getProject();
PsiFile psiFile = BallerinaPsiImplUtil.findPsiFileInSDK(project, typeNameNode, "/ballerina/builtin/" + valueTypeName + "lib.bal");
if (psiFile == null) {
return new LookupElement[0];
}
List<LookupElement> results = new LinkedList<>();
List<IdentifierPSINode> functionDefinitions = BallerinaPsiImplUtil.getMatchingElementsFromAFile(psiFile, FunctionDefinitionNode.class, false);
results.addAll(BallerinaCompletionUtils.createFunctionLookupElements(functionDefinitions));
return results.toArray(new LookupElement[results.size()]);
}
use of org.ballerinalang.plugins.idea.psi.IdentifierPSINode in project ballerina by ballerina-lang.
the class AnnotationReference method getVariants.
@NotNull
public List<LookupElement> getVariants(boolean allAnnotations) {
List<LookupElement> results = new LinkedList<>();
IdentifierPSINode identifier = getElement();
PsiElement parent = identifier.getParent();
PackageNameNode packageNameNode = PsiTreeUtil.getChildOfType(parent, PackageNameNode.class);
if (packageNameNode == null) {
results.addAll(getVariantsFromCurrentPackage(allAnnotations));
} else {
results.addAll(getVariantsFromPackage(packageNameNode, allAnnotations));
}
return results;
}
use of org.ballerinalang.plugins.idea.psi.IdentifierPSINode in project ballerina by ballerina-lang.
the class AnnotationReference method resolveInCurrentPackage.
@Nullable
private PsiElement resolveInCurrentPackage() {
IdentifierPSINode identifier = getElement();
PsiElement parent = identifier.getParent();
PsiFile containingFile = parent.getContainingFile();
PsiFile originalFile = containingFile.getOriginalFile();
PsiDirectory currentPackage = originalFile.getParent();
if (currentPackage == null) {
return null;
}
return findMatchingAnnotationDefinition(currentPackage, true);
}
Aggregations