@Override
    public @Nullable FileType detect(@NotNull VirtualFile file, @NotNull ByteSequence firstBytes, @Nullable CharSequence firstCharsIfText) {
      if (file.isDirectory()) {
        return null;
      }
      // additional precaution: sometimes TextMate erroneously thinks the file is his, when in reality it's a huge binary
      if (firstCharsIfText == null) {
        return null;
      }
      CharSequence fileName = file.getNameSequence();
      FileType originalFileType = FileTypeManager.getInstance().getFileTypeByFileName(fileName);
      if (!isTypeShouldBeReplacedByTextMateType(originalFileType)) {
        return null;
      }
      boolean textMateRecognizesMe = false;
      try {
        textMateRecognizesMe = TextMateService.getInstance().getLanguageDescriptorByFileName(fileName) != null;
      }
      catch (ProcessCanceledException ignored) {
      }
      if (!textMateRecognizesMe) {
        return null;
      }
      return INSTANCE;
    }
@Override
    public @Nullable FileType detect(@NotNull VirtualFile file, @NotNull ByteSequence firstBytes, @Nullable CharSequence firstCharsIfText)