Merge remote-tracking branch 'origin/8.0'

Reverts/comments out parts of 45f93a817a,
which needs to be resolved in a follow-up commit.

 Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
	src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
	src/plugins/cmakeprojectmanager/cmakesettingspage.cpp
	src/plugins/python/pythoneditor.cpp
	src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
	src/plugins/scxmleditor/common/colorsettings.cpp

Change-Id: I7f0f7b7120e75a9fc3a8886bc57c17345cbb501b
This commit is contained in:
Eike Ziller
2022-08-19 09:01:32 +02:00
81 changed files with 1673 additions and 545 deletions

View File

@@ -157,6 +157,20 @@ static void checkSystemForClangdSuitability()
Core::ICore::infoBar()->addInfo(info);
}
static void updateParserConfig(ClangdClient *client)
{
if (!client->reachable())
return;
if (const auto editor = TextEditor::BaseTextEditor::currentTextEditor()) {
if (!client->documentOpen(editor->textDocument()))
return;
const Utils::FilePath filePath = editor->textDocument()->filePath();
if (const auto processor = ClangEditorDocumentProcessor::get(filePath.toString()))
client->updateParserConfig(filePath, processor->parserConfig());
}
}
ClangModelManagerSupport::ClangModelManagerSupport()
{
watchForExternalChanges();
@@ -382,6 +396,13 @@ void ClangModelManagerSupport::updateLanguageClient(
if (Client * const oldClient = clientForProject(project))
LanguageClientManager::shutdownClient(oldClient);
ClangdClient * const client = new ClangdClient(project, jsonDbDir);
connect(client, &Client::shadowDocumentSwitched, this, [](const Utils::FilePath &fp) {
ClangdClient::handleUiHeaderChange(fp.fileName());
});
connect(CppModelManager::instance(),
&CppModelManager::projectPartsUpdated,
client,
[client] { updateParserConfig(client); });
connect(client, &Client::initialized, this, [this, client, project, projectInfo, jsonDbDir] {
using namespace ProjectExplorer;
if (!SessionManager::hasProject(project))
@@ -393,25 +414,15 @@ void ClangModelManagerSupport::updateLanguageClient(
if (!newProjectInfo || *newProjectInfo != *projectInfo)
return;
const auto updateParserConfig = [client] {
if (const auto editor = TextEditor::BaseTextEditor::currentTextEditor()) {
if (!client->documentOpen(editor->textDocument()))
return;
const Utils::FilePath filePath = editor->textDocument()->filePath();
if (const auto processor = ClangEditorDocumentProcessor::get(
filePath.toString())) {
const CppEditor::BaseEditorDocumentParser::Configuration config
= processor->parserConfig();
client->updateParserConfig(filePath, config);
}
}
};
// Acquaint the client with all open C++ documents for this project.
bool hasDocuments = false;
const ClangdSettings settings(ClangdProjectSettings(project).settings());
for (TextEditor::TextDocument * const doc : allCppDocuments()) {
Client * const currentClient = LanguageClientManager::clientForDocument(doc);
if (currentClient == client) {
hasDocuments = true;
continue;
}
if (!settings.sizeIsOkay(doc->filePath()))
continue;
const Project * const docProject = SessionManager::projectForFile(doc->filePath());
@@ -440,17 +451,8 @@ void ClangModelManagerSupport::updateLanguageClient(
++it;
}
}
connect(client, &Client::shadowDocumentSwitched, this,
[](const Utils::FilePath &fp) {
ClangdClient::handleUiHeaderChange(fp.fileName());
});
if (client->state() == Client::Initialized)
updateParserConfig();
else
connect(client, &Client::initialized, client, updateParserConfig);
connect(CppModelManager::instance(), &CppModelManager::projectPartsUpdated,
client, updateParserConfig);
updateParserConfig(client);
if (hasDocuments)
return;