mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Enabled detecting file by content for PlainTextLike file types (IDEA-219004)
GitOrigin-RevId: a47be1dd389e19a8d7f0a257968673e5430489d2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e96bba88b8
commit
bc15a9937e
+3
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user