public static @NotNull Language findLanguageFromElement(@NotNull PsiElement elt) {
    if (!(elt instanceof PsiFile) && elt.getFirstChild() == null) { //is leaf
      PsiElement parent = elt.getParent();
      if (parent != null) {
        return parent.getLanguage();
      }
    }

    return elt.getLanguage();
  }
public static @NotNull Language findLanguageFromElement(@NotNull PsiElement elt)