void (final @NotNull MultiHostRegistrar registrar, final @NotNull PsiElement host) { Pair<ASTNode, ASTNode> pair = parseConditionalCommentBoundaries(host); if (pair == null) { return; } final TextRange textRange = host.getTextRange(); final int startOffset = textRange.getStartOffset(); Language language = host.getParent().getLanguage(); ASTNode conditionalStart = pair.first; ASTNode conditionalEnd = pair.second; TextRange range = new UnfairTextRange(conditionalStart.getTextRange().getEndOffset() - startOffset, conditionalEnd.getStartOffset() - startOffset); if (range.getStartOffset() < range.getEndOffset()) { ASTNode current = conditionalStart.getTreeNext(); List<TextRange> injectionsRanges = new ArrayList<>(); while (current != conditionalEnd) { if (!(current.getPsi() instanceof OuterLanguageElement)) { injectionsRanges.add(current.getTextRange().shiftLeft(startOffset)); } current = current.getTreeNext(); } if (!injectionsRanges.isEmpty()) { registrar.startInjecting(language); for (TextRange injectionsRange : injectionsRanges) { registrar.addPlace(null, null, (PsiLanguageInjectionHost)host, injectionsRange); } registrar.doneInjecting(); } } }