@Nullable
  public FileType getRegisteredFileTypeFromLanguageHierarchy(@NotNull FileType type) {
    if (super.forFileType(type) != null) return type;

    while (type instanceof LanguageFileType lft) {
      Language language = lft.getLanguage();
      if (!lft.isSecondary()) {
        language = language.getBaseLanguage();
      }
      if (language == null) {
        break;
      }

      FileType primaryFileType = FileTypeRegistry.getInstance().findFileTypeByLanguage(language);
      if (primaryFileType == null) break;
      if (super.forFileType(primaryFileType) != null) return primaryFileType;

      type = primaryFileType;
    }

    return null;
  }
@Nullable
  public FileType getRegisteredFileTypeFromLanguageHierarchy(@NotNull FileType type)