diff --git a/platform/lang-impl/src/com/intellij/ide/scratch/ScratchFileType.java b/platform/lang-impl/src/com/intellij/ide/scratch/ScratchFileType.java
index d3232a428452..abac965ebed4 100644
--- a/platform/lang-impl/src/com/intellij/ide/scratch/ScratchFileType.java
+++ b/platform/lang-impl/src/com/intellij/ide/scratch/ScratchFileType.java
@@ -34,7 +34,7 @@ public class ScratchFileType extends LanguageFileType implements FileTypeIdentif
public static final LanguageFileType INSTANCE = new ScratchFileType();
ScratchFileType() {
- super(PlainTextLanguage.INSTANCE);
+ super(PlainTextLanguage.INSTANCE, true);
}
@Override
diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml
index fcb8dd10379c..5304aaf5469b 100644
--- a/platform/platform-resources/src/META-INF/LangExtensions.xml
+++ b/platform/platform-resources/src/META-INF/LangExtensions.xml
@@ -362,7 +362,7 @@
-
+
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java
index 9260020f8203..ae4e521e603b 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java
@@ -835,6 +835,22 @@ public class FileTypesTest extends HeavyPlatformTestCase {
assertEquals(1, detectorCalls.get());
}
+ public void testUniqueLanguage() {
+ Map map = new HashMap<>();
+ for (FileType type : FileTypeManager.getInstance().getRegisteredFileTypes()) {
+ if (!(type instanceof LanguageFileType)) continue;
+ LanguageFileType languageFileType = (LanguageFileType)type;
+ if (!languageFileType.isSecondary()) {
+ String id = languageFileType.getLanguage().getID();
+ LanguageFileType oldFileType = map.get(id);
+ if (oldFileType != null) {
+ fail("Multiple primary file types for language " + id + ": "+ oldFileType.getName() + ", " + languageFileType.getName());
+ }
+ map.put(id, languageFileType);
+ }
+ }
+ }
+
@NotNull
private static FileType createTestFileType() {
return new FileType() {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMFileType.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMFileType.java
index bc98879b9d85..8d6b8b90b0a2 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMFileType.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMFileType.java
@@ -15,7 +15,7 @@ import javax.swing.*;
public class DGMFileType extends LanguageFileType implements FileTypeIdentifiableByVirtualFile {
public static final DGMFileType INSTANCE = new DGMFileType();
private DGMFileType() {
- super(PropertiesLanguage.INSTANCE);
+ super(PropertiesLanguage.INSTANCE, true);
}
@NotNull