use of com.perl5.lang.perl.psi.PerlNamespaceElement in project Perl5-IDEA by Camelcade.
the class PerlImportedSubsCompletionProvider method addCompletions.
public void addCompletions(@NotNull final CompletionParameters parameters, ProcessingContext context, @NotNull final CompletionResultSet resultSet) {
PsiElement position = parameters.getPosition();
PsiPerlMethod method = (PsiPerlMethod) position.getParent();
if (method.isObjectMethod()) {
return;
}
Project project = method.getProject();
if (!method.hasExplicitNamespace()) {
PerlNamespaceDefinitionElement namespaceContainer = PerlPackageUtil.getNamespaceContainerForElement(position);
if (namespaceContainer != null) {
fillWithNamespaceImports(namespaceContainer, resultSet);
}
} else {
// not an object method, but has explicit namespace
PerlNamespaceElement namespaceElement = method.getNamespaceElement();
if (namespaceElement != null) {
String targetPackageName = namespaceElement.getCanonicalName();
if (targetPackageName != null) {
for (PerlNamespaceDefinitionElement namespaceDefinition : PerlPackageUtil.getNamespaceDefinitions(project, targetPackageName)) {
fillWithNamespaceImports(namespaceDefinition, resultSet);
}
}
}
}
}
Aggregations