protected final boolean isNearTemplateExpressions(@NotNull PsiFile file, int start, int end) {
    FileViewProvider viewProvider = file.getViewProvider();
    if (isTemplateViewProvider(viewProvider) && file.getLanguage() != viewProvider.getBaseLanguage()) {
      CharSequence fileText = viewProvider.getContents();
      PsiElement beforeWs = findBaseLanguageElement(viewProvider, CharArrayUtil.shiftBackward(fileText, start - 1, " \t\n"));
      PsiElement afterWs = findBaseLanguageElement(viewProvider, CharArrayUtil.shiftForward(fileText, end, " \t\n"));
      if (isTemplateEdge(afterWs) || isTemplateEdge(beforeWs) || hasTemplateInside(start, end, viewProvider)) {
        return true;
      }
    }

    InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(file.getProject());
    PsiElement host = injectedLanguageManager.getInjectionHost(file);
    if (host != null) {
      start = injectedLanguageManager.injectedToHost(file, start);
      end = injectedLanguageManager.injectedToHost(file, end);
      if (start <= end) {
        return isNearTemplateExpressions(host.getContainingFile(), start, end);
      }
    }

    return false;
  }
protected final boolean isNearTemplateExpressions(@NotNull PsiFile file, int start, int end)