Merge remote-tracking branch 'origin/6.0'

Conflicts:
	src/plugins/coreplugin/editormanager/editormanager.cpp

Change-Id: I80fe565749ad5c06dfe99436f2dc6ab4b66a2537
This commit is contained in:
Eike Ziller
2021-12-16 10:50:33 +01:00
156 changed files with 2801 additions and 1439 deletions

View File

@@ -436,7 +436,9 @@ static void addPythonsFromPath(QList<Interpreter> &pythons)
static QString idForPythonFromPath(QList<Interpreter> pythons)
{
const FilePath &pythonFromPath = Environment::systemEnvironment().searchInPath("python");
FilePath pythonFromPath = Environment::systemEnvironment().searchInPath("python3");
if (pythonFromPath.isEmpty())
pythonFromPath = Environment::systemEnvironment().searchInPath("python");
if (pythonFromPath.isEmpty())
return {};
const Interpreter &defaultInterpreter

View File

@@ -116,7 +116,7 @@ FilePath getPylsModulePath(CommandLine pylsCommand)
static const QString pylsInitPattern = "(.*)"
+ QRegularExpression::escape(
QDir::toNativeSeparators("/pyls/__init__.py"))
QDir::toNativeSeparators("/pylsp/__init__.py"))
+ '$';
static const QRegularExpression regexCached(" matches " + pylsInitPattern,
QRegularExpression::MultilineOption);
@@ -149,7 +149,7 @@ QList<const StdIOSettings *> configuredPythonLanguageServer()
static PythonLanguageServerState checkPythonLanguageServer(const FilePath &python)
{
using namespace LanguageClient;
const CommandLine pythonLShelpCommand(python, {"-m", "pyls", "-h"});
const CommandLine pythonLShelpCommand(python, {"-m", "pylsp", "-h"});
const FilePath &modulePath = getPylsModulePath(pythonLShelpCommand);
for (const StdIOSettings *serverSetting : configuredPythonLanguageServer()) {
if (modulePath == getPylsModulePath(serverSetting->command())) {
@@ -217,7 +217,7 @@ const StdIOSettings *PyLSConfigureAssistant::languageServerForPython(const FileP
{
return findOrDefault(configuredPythonLanguageServer(),
[pythonModulePath = getPylsModulePath(
CommandLine(python, {"-m", "pyls"}))](const StdIOSettings *setting) {
CommandLine(python, {"-m", "pylsp"}))](const StdIOSettings *setting) {
return getPylsModulePath(setting->command()) == pythonModulePath;
});
}
@@ -226,7 +226,7 @@ static Client *registerLanguageServer(const FilePath &python)
{
auto *settings = new StdIOSettings();
settings->m_executable = python;
settings->m_arguments = "-m pyls";
settings->m_arguments = "-m pylsp";
settings->m_name = PyLSConfigureAssistant::tr("Python Language Server (%1)")
.arg(pythonName(python));
settings->m_languageFilter.mimeTypes = QStringList(Constants::C_PY_MIMETYPE);
@@ -266,7 +266,7 @@ public:
connect(&m_killTimer, &QTimer::timeout, this, &PythonLSInstallHelper::cancel);
connect(&m_watcher, &QFutureWatcher<void>::canceled, this, &PythonLSInstallHelper::cancel);
QStringList arguments = {"-m", "pip", "install", "python-language-server[all]"};
QStringList arguments = {"-m", "pip", "install", "python-lsp-server[all]"};
// add --user to global pythons, but skip it for venv pythons
if (!QDir(m_python.parentDir().toString()).exists("activate"))