use of com.perl5.lang.perl.idea.intellilang.PerlHeredocLanguageInjector in project Perl5-IDEA by Camelcade.
the class PerlHeredocInjectionTestCase method getHeredocDecodedText.
protected String getHeredocDecodedText(@Nullable PerlHeredocElementImpl heredocElement) {
assertNotNull(heredocElement);
StringBuilder sb = new StringBuilder();
LiteralTextEscaper<PerlHeredocElementImpl> escaper = heredocElement.createLiteralTextEscaper();
// host MUST be auto-injected with our own injector
new PerlHeredocLanguageInjector().getLanguagesToInject(new MultiHostRegistrar() {
@NotNull
@Override
public MultiHostRegistrar startInjecting(@NotNull Language language) {
return this;
}
@NotNull
@Override
public MultiHostRegistrar addPlace(@Nullable String prefix, @Nullable String suffix, @NotNull PsiLanguageInjectionHost host, @NotNull TextRange rangeInsideHost) {
escaper.decode(rangeInsideHost, sb);
return this;
}
@Override
public void doneInjecting() {
}
}, heredocElement);
return sb.toString();
}
Aggregations