diff --git a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp index 74c35a7b5ca..0c0fc17a204 100644 --- a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp +++ b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp @@ -4,6 +4,7 @@ #include "ieditorfactory.h" #include "ieditorfactory_p.h" #include "editormanager.h" +#include "../coreconstants.h" #include #include @@ -36,6 +37,14 @@ static void mimeTypeFactoryLookup(const Utils::MimeType &mimeType, } return true; // continue }); + // Always offer the plain text editor as a fallback for the case that the mime type + // is not detected correctly. + if (auto plainTextEditorFactory = Utils::findOrDefault( + allFactories, + Utils::equal(&IEditorFactory::id, Utils::Id(Constants::K_DEFAULT_TEXT_EDITOR_ID)))) { + if (!matches.contains(plainTextEditorFactory)) + list->append(plainTextEditorFactory); + } } /*!