private static PsiElement findInside(
     @NotNull PsiElement element,
     @NotNull PsiFile hostFile,
     final int hostOffset,
     @NotNull final PsiDocumentManager documentManager) {
   final Ref<PsiElement> out = new Ref<PsiElement>();
   enumerate(
       element,
       hostFile,
       true,
       new PsiLanguageInjectionHost.InjectedPsiVisitor() {
         @Override
         public void visit(
             @NotNull PsiFile injectedPsi, @NotNull List<PsiLanguageInjectionHost.Shred> places) {
           for (PsiLanguageInjectionHost.Shred place : places) {
             TextRange hostRange = place.getHost().getTextRange();
             if (hostRange.cutOut(place.getRangeInsideHost()).grown(1).contains(hostOffset)) {
               DocumentWindowImpl document =
                   (DocumentWindowImpl) documentManager.getCachedDocument(injectedPsi);
               if (document == null) return;
               int injectedOffset = document.hostToInjected(hostOffset);
               PsiElement injElement = injectedPsi.findElementAt(injectedOffset);
               out.set(injElement == null ? injectedPsi : injElement);
             }
           }
         }
       });
   return out.get();
 }
 public static boolean hasInjections(@NotNull PsiLanguageInjectionHost host) {
   if (!host.isPhysical()) return false;
   final Ref<Boolean> result = Ref.create(false);
   enumerate(
       host,
       new PsiLanguageInjectionHost.InjectedPsiVisitor() {
         @Override
         public void visit(
             @NotNull final PsiFile injectedPsi,
             @NotNull final List<PsiLanguageInjectionHost.Shred> places) {
           result.set(true);
         }
       });
   return result.get().booleanValue();
 }