use of com.perl5.lang.perl.idea.intellilang.PerlInjectionMarkersService in project Perl5-IDEA by Camelcade.
the class PerlStringCompletionUtil method fillWithHeredocOpeners.
public static void fillWithHeredocOpeners(@NotNull PerlCompletionProcessor completionProcessor) {
Project project = completionProcessor.getProject();
Set<String> heredocOpenersCache = PerlStringCompletionCache.getInstance(project).getHeredocOpenersCache();
// cached values
for (String marker : heredocOpenersCache) {
if (completionProcessor.matches(marker) && !completionProcessor.process(LookupElementBuilder.create(marker))) {
return;
}
}
PerlInjectionMarkersService injectionService = PerlInjectionMarkersService.getInstance(project);
// collect new values
PsiFile file = completionProcessor.getContainingFile();
file.accept(new PerlCompletionRecursiveVisitor(completionProcessor) {
@Override
public void visitHeredocOpener(@NotNull PsiPerlHeredocOpener o) {
String openerName = o.getName();
if (StringUtil.isNotEmpty(openerName) && heredocOpenersCache.add(openerName) && injectionService.getLanguageByMarker(openerName) == null && !completionProcessor.process(LookupElementBuilder.create(o, openerName))) {
return;
}
super.visitHeredocOpener(o);
}
});
}
Aggregations