use of com.perl5.lang.perl.psi.PsiPerlAnnotationInject in project Perl5-IDEA by Camelcade.
the class PerlStringContentCompletionProvider method addCompletions.
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull final CompletionResultSet result) {
PsiElement element = parameters.getPosition();
PsiElement parent = element.getParent();
if (parent instanceof PsiLanguageInjectionHost && PerlInjectionUtil.hasInjections(parent)) {
return;
}
if (// exporter assignments
EXPORT_ASSIGNED_STRING_CONTENT.accepts(element)) {
PerlStringCompletionUtil.fillWithExportableEntities(element, result);
} else if (// hash indexes
SIMPLE_HASH_INDEX.accepts(element)) {
PsiPerlHashIndex indexElement = PsiTreeUtil.getParentOfType(element, PsiPerlHashIndex.class);
if (indexElement != null && indexElement.getParent() instanceof PsiPerlGlobSlot) {
PerlStringCompletionUtil.fillWithRefTypes(result);
} else {
PerlStringCompletionUtil.fillWithHashIndexes(element, result);
}
} else if (// use or no parameters
USE_PARAMETERS_PATTERN.accepts(element)) {
PerlStringCompletionUtil.fillWithUseParameters(element, result);
} else if (// #@Inject some
parent != null && parent.getParent() instanceof PsiPerlAnnotationInject) {
PerlStringCompletionUtil.fillWithInjectableMarkers(element, result);
result.stopHere();
} else if (// HERE-DOC openers
STRING_CONTENT_IN_HEREDOC_OPENER_PATTERN.accepts(element)) {
PerlStringCompletionUtil.fillWithInjectableMarkers(element, result);
PerlStringCompletionUtil.fillWithHeredocOpeners(element, result);
} else if (// begin of string or qw element
STRING_CONTENT_IN_LIST_OR_STRING_START.accepts(element)) {
PerlStringCompletionUtil.fillWithRefTypes(result);
PerlPackageCompletionUtil.fillWithAllPackageNames(element, result);
}
}
Aggregations