Enabled detecting file by content for PlainTextLike file types (IDEA-219004)

GitOrigin-RevId: a47be1dd389e19a8d7f0a257968673e5430489d2
This commit is contained in:
Alexander Zolotov
2019-08-01 21:02:48 +03:00
committed by intellij-monorepo-bot
parent e96bba88b8
commit bc15a9937e
@@ -708,12 +708,10 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent
@NotNull
public FileType getFileTypeByFile(@NotNull VirtualFile file, @Nullable byte[] content) {
FileType fileType = getByFile(file);
if (fileType == null) {
fileType = file instanceof StubVirtualFile ? UnknownFileType.INSTANCE : getOrDetectFromContent(file, content);
if ((fileType == null || fileType instanceof PlainTextLikeFileType) && file instanceof StubVirtualFile) {
return getOrDetectFromContent(file, content);
}
return fileType;
return ObjectUtils.notNull(fileType, UnknownFileType.INSTANCE);
}
@Nullable // null means all conventional detect methods returned UnknownFileType.INSTANCE, have to detect from content