public static Set<TemplateContextType> getApplicableContextTypes(@NotNull TemplateActionContext templateActionContext) {
    Set<TemplateContextType> result = getDirectlyApplicableContextTypes(templateActionContext);

    PsiFile file = templateActionContext.getFile();
    Language baseLanguage = file.getViewProvider().getBaseLanguage();
    if (baseLanguage != file.getLanguage()) {
      PsiFile basePsi = file.getViewProvider().getPsi(baseLanguage);
      if (basePsi != null) {
        result.addAll(getDirectlyApplicableContextTypes(templateActionContext.withFile(basePsi)));
      }
    }

    // if we have, for example, a Ruby fragment in ERB selected with its exact bounds, the file language and the base
    // language will be ERB, so we won't match HTML templates for it. but they're actually valid
    Language languageAtOffset = PsiUtilCore.getLanguageAtOffset(file, templateActionContext.getStartOffset());
    if (languageAtOffset != file.getLanguage() && languageAtOffset != baseLanguage) {
      PsiFile basePsi = file.getViewProvider().getPsi(languageAtOffset);
      if (basePsi != null) {
        result.addAll(getDirectlyApplicableContextTypes(templateActionContext.withFile(basePsi)));
      }
    }

    return result;
  }
public static Set<TemplateContextType> getApplicableContextTypes(@NotNull TemplateActionContext templateActionContext)