diff --git a/src/plugins/python/pythonconstants.h b/src/plugins/python/pythonconstants.h index 330f073ebcb..76f4ca2bb52 100644 --- a/src/plugins/python/pythonconstants.h +++ b/src/plugins/python/pythonconstants.h @@ -49,6 +49,7 @@ const char PYLS_SETTINGS_ID[] = "Python.PyLSSettingsID"; * MIME type ******************************************************************************/ const char C_PY_MIMETYPE[] = "text/x-python"; +const char C_PY3_MIMETYPE[] = "text/x-python3"; const char C_PY_MIME_ICON[] = "text-x-python"; } // namespace Constants diff --git a/src/plugins/python/pythonlanguageclient.cpp b/src/plugins/python/pythonlanguageclient.cpp index 9479fc0c1a1..ddab091bf67 100644 --- a/src/plugins/python/pythonlanguageclient.cpp +++ b/src/plugins/python/pythonlanguageclient.cpp @@ -389,7 +389,8 @@ PyLSSettings::PyLSSettings() m_settingsTypeId = Constants::PYLS_SETTINGS_ID; m_name = "Python Language Server"; m_startBehavior = RequiresFile; - m_languageFilter.mimeTypes = QStringList(Constants::C_PY_MIMETYPE); + m_languageFilter.mimeTypes = QStringList() + << Constants::C_PY_MIMETYPE << Constants::C_PY3_MIMETYPE; m_arguments = "-m pylsp"; const QJsonDocument config(defaultConfiguration()); m_configuration = QString::fromUtf8(config.toJson()); @@ -416,6 +417,8 @@ void PyLSSettings::fromMap(const QVariantMap &map) const QJsonDocument config(defaultConfiguration()); m_configuration = QString::fromUtf8(config.toJson()); } + m_languageFilter.mimeTypes = QStringList() + << Constants::C_PY_MIMETYPE << Constants::C_PY3_MIMETYPE; setInterpreter(map[interpreterKey].toString()); } @@ -640,7 +643,8 @@ static Client *registerLanguageServer(const FilePath &python) auto *settings = new StdIOSettings(); settings->m_executable = python; settings->m_arguments = "-m pylsp"; - settings->m_languageFilter.mimeTypes = QStringList(Constants::C_PY_MIMETYPE); + settings->m_languageFilter.mimeTypes = QStringList() << Constants::C_PY_MIMETYPE + << Constants::C_PY3_MIMETYPE; } settings->m_name = PyLSConfigureAssistant::tr("Python Language Server (%1)") .arg(pythonName(python)); diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index fe4623dd8de..c88bbb26629 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -236,7 +236,8 @@ void PythonRunConfiguration::currentInterpreterChanged() for (FilePath &file : project()->files(Project::AllFiles)) { if (auto document = TextEditor::TextDocument::textDocumentForFilePath(file)) { - if (document->mimeType() == Constants::C_PY_MIMETYPE) { + if (document->mimeType() == Constants::C_PY_MIMETYPE + || document->mimeType() == Constants::C_PY3_MIMETYPE) { PyLSConfigureAssistant::openDocumentWithPython(python, document); PySideInstaller::checkPySideInstallation(python, document); }