Merge remote-tracking branch 'origin/12.0'

Change-Id: Ib09af70f157a6c7d6cbda4e3de678fd2bbceb229
This commit is contained in:
Eike Ziller
2023-11-20 09:48:43 +01:00
14 changed files with 53725 additions and 33031 deletions

View File

@@ -333,7 +333,7 @@ void QtTestOutputReader::processPlainTextOutput(const QByteArray &outputLine)
static const QRegularExpression result("^(PASS |FAIL! |XFAIL |XPASS |SKIP |RESULT "
"|BPASS |BFAIL |BXPASS |BXFAIL "
"|INFO |QWARN |WARNING|QDEBUG |QSYSTEM): (.*)$");
"|INFO |QWARN |WARNING|QDEBUG |QSYSTEM|QCRITICAL): (.*)$");
static const QRegularExpression benchDetails("^\\s+([\\d,.]+ .* per iteration "
"\\(total: [\\d,.]+, iterations: \\d+\\))$");

View File

@@ -61,7 +61,9 @@ ResultType TestResult::resultFromString(const QString &resultString)
return ResultType::MessageWarn;
if (resultString == "qfatal")
return ResultType::MessageFatal;
if ((resultString == "system") || (resultString == "qsystem"))
if (resultString == "error" || resultString == "qcritical")
return ResultType::MessageError;
if (resultString == "system" || resultString == "qsystem")
return ResultType::MessageSystem;
if (resultString == "bpass")
return ResultType::BlacklistedPass;

View File

@@ -140,6 +140,7 @@ void TestResultItem::updateResult(bool &changed, ResultType addedChildType,
break;
case ResultType::ExpectedFail:
case ResultType::MessageWarn:
case ResultType::MessageError:
case ResultType::MessageSystem:
case ResultType::Skip:
case ResultType::BlacklistedFail:

View File

@@ -799,6 +799,11 @@ void ClangModelManagerSupport::watchForExternalChanges()
if (!LanguageClientManager::hasClients<ClangdClient>())
return;
for (const FilePath &file : files) {
if (TextEditor::TextDocument::textDocumentForFilePath(file)) {
// if we have a document for that file we should receive the content
// change via the document signals
continue;
}
const ProjectFile::Kind kind = ProjectFile::classify(file.toString());
if (!ProjectFile::isSource(kind) && !ProjectFile::isHeader(kind))
continue;

View File

@@ -2040,21 +2040,15 @@ void ClangdTestExternalChanges::test()
QVERIFY(curDoc->marks().isEmpty());
// Now trigger an external change in an open, but not currently visible file and
// verify that we get a new client and diagnostics in the current editor.
// verify that we get diagnostics in the current editor.
TextDocument * const docToChange = document("mainwindow.cpp");
docToChange->setSilentReload();
QFile otherSource(filePath("mainwindow.cpp").toString());
QVERIFY(otherSource.open(QIODevice::WriteOnly));
otherSource.write("blubb");
otherSource.close();
QVERIFY(waitForSignalOrTimeout(LanguageClientManager::instance(),
&LanguageClientManager::clientAdded, timeOutInMs()));
ClangdClient * const newClient = ClangModelManagerSupport::clientForProject(project());
QVERIFY(newClient);
QVERIFY(newClient != oldClient);
newClient->enableTesting();
if (curDoc->marks().isEmpty())
QVERIFY(waitForSignalOrTimeout(newClient, &ClangdClient::textMarkCreated, timeOutInMs()));
QVERIFY(waitForSignalOrTimeout(client(), &ClangdClient::textMarkCreated, timeOutInMs()));
}
ClangdTestIndirectChanges::ClangdTestIndirectChanges()

View File

@@ -278,8 +278,11 @@ bool CMakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FileP
return target.title == targetName;
});
if (target.backtrace.isEmpty())
if (target.backtrace.isEmpty()) {
qCCritical(cmakeBuildSystemLog) << "target.backtrace for" << targetName << "is empty. "
<< "The location where to add the files is unknown.";
return false;
}
const FilePath targetCMakeFile = target.backtrace.last().path;
const int targetDefinitionLine = target.backtrace.last().line;
@@ -295,6 +298,8 @@ bool CMakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FileP
if (!cmakeListFile.ParseString(fileContent->toStdString(),
targetCMakeFile.fileName().toStdString(),
errorString)) {
qCCritical(cmakeBuildSystemLog).noquote()
<< targetCMakeFile.path() << "failed to parse! Error:" << errorString;
return false;
}
}
@@ -305,8 +310,11 @@ bool CMakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FileP
return func.Line() == targetDefinitionLine;
});
if (function == cmakeListFile.Functions.end())
if (function == cmakeListFile.Functions.end()) {
qCCritical(cmakeBuildSystemLog) << "Function that defined the target" << targetName
<< "could not be found at" << targetDefinitionLine;
return false;
}
// Special case: when qt_add_executable and qt_add_qml_module use the same target name
// then qt_add_qml_module function should be used
@@ -380,13 +388,20 @@ bool CMakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FileP
Core::EditorManager::openEditorAt({targetCMakeFile, line, column + extraChars},
Constants::CMAKE_EDITOR_ID,
Core::EditorManager::DoNotMakeVisible));
if (!editor)
if (!editor) {
qCCritical(cmakeBuildSystemLog).noquote()
<< "BaseTextEditor cannot be obtained for" << targetCMakeFile.path() << line
<< int(column + extraChars);
return false;
}
editor->insert(snippet);
editor->editorWidget()->autoIndent();
if (!Core::DocumentManager::saveDocument(editor->document()))
if (!Core::DocumentManager::saveDocument(editor->document())) {
qCCritical(cmakeBuildSystemLog).noquote()
<< "Changes to" << targetCMakeFile.path() << "could not be saved.";
return false;
}
if (notAdded)
notAdded->clear();
@@ -533,6 +548,9 @@ RemovedFilesFromProject CMakeBuildSystem::removeFiles(Node *context,
if (filePos) {
if (!filePos.value().cmakeFile.exists()) {
badFiles << file;
qCCritical(cmakeBuildSystemLog).noquote()
<< "File" << filePos.value().cmakeFile.path() << "does not exist.";
continue;
}
@@ -545,6 +563,11 @@ RemovedFilesFromProject CMakeBuildSystem::removeFiles(Node *context,
Core::EditorManager::DoNotMakeVisible));
if (!editor) {
badFiles << file;
qCCritical(cmakeBuildSystemLog).noquote()
<< "BaseTextEditor cannot be obtained for"
<< filePos.value().cmakeFile.path() << filePos.value().argumentPosition.Line
<< int(filePos.value().argumentPosition.Column - 1);
continue;
}
@@ -559,6 +582,10 @@ RemovedFilesFromProject CMakeBuildSystem::removeFiles(Node *context,
editor->editorWidget()->autoIndent();
if (!Core::DocumentManager::saveDocument(editor->document())) {
badFiles << file;
qCCritical(cmakeBuildSystemLog).noquote()
<< "Changes to" << filePos.value().cmakeFile.path()
<< "could not be saved.";
continue;
}
} else {
@@ -622,8 +649,11 @@ bool CMakeBuildSystem::renameFile(Node *context,
";");
auto fileToRename = m_filesToBeRenamed.take(key);
if (!fileToRename.cmakeFile.exists())
if (!fileToRename.cmakeFile.exists()) {
qCCritical(cmakeBuildSystemLog).noquote()
<< "File" << fileToRename.cmakeFile.path() << "does not exist.";
return false;
}
BaseTextEditor *editor = qobject_cast<BaseTextEditor *>(
Core::EditorManager::openEditorAt({fileToRename.cmakeFile,
@@ -632,8 +662,12 @@ bool CMakeBuildSystem::renameFile(Node *context,
- 1)},
Constants::CMAKE_EDITOR_ID,
Core::EditorManager::DoNotMakeVisible));
if (!editor)
if (!editor) {
qCCritical(cmakeBuildSystemLog).noquote()
<< "BaseTextEditor cannot be obtained for" << fileToRename.cmakeFile.path()
<< fileToRename.argumentPosition.Line << int(fileToRename.argumentPosition.Column);
return false;
}
// If quotes were used for the source file, skip the starting quote
if (fileToRename.argumentPosition.Delim == cmListFileArgument::Quoted)
@@ -643,8 +677,11 @@ bool CMakeBuildSystem::renameFile(Node *context,
editor->replace(fileToRename.relativeFileName.length(), newRelPathName);
editor->editorWidget()->autoIndent();
if (!Core::DocumentManager::saveDocument(editor->document()))
if (!Core::DocumentManager::saveDocument(editor->document())) {
qCCritical(cmakeBuildSystemLog).noquote()
<< "Changes to" << fileToRename.cmakeFile.path() << "could not be saved.";
return false;
}
return true;
}

View File

@@ -665,7 +665,10 @@ static void addCompileGroups(ProjectNode *targetRoot,
sourceDirectory,
targetRoot);
if (showSourceFolders) {
insertNode->addNestedNodes(std::move(current), sourceDirectory);
FilePath baseDir = sourceDirectory.pathAppended(td.sourceGroups[i]);
if (!baseDir.exists())
baseDir = sourceDirectory;
insertNode->addNestedNodes(std::move(current), baseDir);
} else {
for (auto &fileNodes : current)
insertNode->addNode(std::move(fileNodes));

View File

@@ -72,7 +72,7 @@ void CopilotSuggestion::reset()
int CopilotSuggestion::position()
{
return m_start.position();
return m_start.selectionEnd();
}
} // namespace Copilot::Internal

View File

@@ -8,6 +8,7 @@
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
@@ -58,9 +59,20 @@ public:
connect(target->project(), &Project::displayNameChanged, this, &RunConfiguration::update);
}
bool isEnabled() const override
{
if (disabled)
return false;
return RunConfiguration::isEnabled();
}
static bool disabled;
StringAspect flashAndRunParameters{this};
};
bool FlashAndRunConfiguration::disabled = false;
class FlashAndRunWorker : public SimpleTargetRunner
{
public:
@@ -74,6 +86,15 @@ public:
setWorkingDirectory(target->activeBuildConfiguration()->buildDirectory());
setEnvironment(target->activeBuildConfiguration()->environment());
});
connect(runControl, &RunControl::started, []() {
FlashAndRunConfiguration::disabled = true;
ProjectExplorerPlugin::updateRunActions();
});
connect(runControl, &RunControl::stopped, []() {
FlashAndRunConfiguration::disabled = false;
ProjectExplorerPlugin::updateRunActions();
});
}
};

View File

@@ -603,7 +603,7 @@ bool TextDocumentLayout::updateSuggestion(const QTextBlock &block,
{
if (TextSuggestion *suggestion = TextDocumentLayout::suggestion(block)) {
auto positionInBlock = position - block.position();
if (positionInBlock < suggestion->position())
if (position < suggestion->position())
return false;
const QString start = block.text().left(positionInBlock);
const QString end = block.text().mid(positionInBlock);