Merge remote-tracking branch 'origin/12.0'

Change-Id: Ib9f8b81d60162a8b01e7c627ba54901af68afa98
This commit is contained in:
Eike Ziller
2023-11-10 11:23:21 +01:00
32 changed files with 240 additions and 142 deletions

View File

@@ -1,6 +1,5 @@
add_qtc_library(Nanotrace
BUILD_DEFAULT OFF
DEFINES NANOTRACE_LIBRARY
PUBLIC_DEFINES NANOTRACE_ENABLED
SOURCES nanotrace.cpp nanotrace.h
PUBLIC_DEPENDS Qt::Core

View File

@@ -7,6 +7,8 @@
#if defined(NANOTRACE_LIBRARY)
# define NANOTRACESHARED_EXPORT Q_DECL_EXPORT
#elif defined(NANOTRACE_STATIC_LIBRARY)
# define NANOTRACESHARED_EXPORT
#else
# define NANOTRACESHARED_EXPORT Q_DECL_IMPORT
#endif

View File

@@ -1,7 +1,6 @@
add_qtc_library(Spinner OBJECT
# Never add dependencies to non-Qt libraries for this library
DEPENDS Qt::Core Qt::Widgets
PUBLIC_DEFINES SPINNER_LIBRARY
SOURCES
spinner.cpp spinner.h
spinner.qrc

View File

@@ -1,7 +1,6 @@
add_qtc_library(Tasking OBJECT
# Never add dependencies to non-Qt libraries for this library
DEPENDS Qt::Concurrent Qt::Core Qt::Network
PUBLIC_DEFINES TASKING_LIBRARY
SOURCES
barrier.cpp barrier.h
concurrentcall.h

View File

@@ -3,6 +3,8 @@ add_qtc_library(Utils
PUBLIC_DEPENDS
Qt::Concurrent Qt::Core Qt::Network Qt::Gui Qt::Widgets
Qt::Core5Compat
$<$<BOOL:${QTC_STATIC_BUILD}>:Tasking>
$<$<BOOL:${QTC_STATIC_BUILD}>:Spinner>
SOURCES
../3rdparty/span/span.hpp
../3rdparty/tl_expected/include/tl/expected.hpp

View File

@@ -12,7 +12,7 @@
#include <QTemporaryFile>
#include <QVersionNumber>
Q_LOGGING_CATEGORY(log, "terminal.externalprocess", QtWarningMsg)
Q_LOGGING_CATEGORY(logTE, "terminal.externalprocess", QtWarningMsg)
namespace Utils {
@@ -155,12 +155,12 @@ expected_str<qint64> ProcessStubCreator::startStubProcess(const ProcessSetupData
QObject::connect(process, &Process::readyReadStandardOutput, process, [process] {
const QString output = process->readAllStandardOutput();
if (!output.isEmpty())
qCWarning(log).noquote() << output;
qCWarning(logTE).noquote() << output;
});
QObject::connect(process, &Process::readyReadStandardError, process, [process] {
const QString output = process->readAllStandardError();
if (!output.isEmpty())
qCCritical(log).noquote() << output;
qCCritical(logTE).noquote() << output;
});
QObject::connect(process, &Process::done, m_interface, &TerminalInterface::onStubExited);

View File

@@ -9381,7 +9381,9 @@ template<typename T> inline T aFunction() { return T(); }
const QByteArrayList headersMemberDecl2Def{R"(
class C {
// Member function comment
/**
* \brief Foo::aMember
*/
void @aMember();
)", R"(
class C {
@@ -9394,7 +9396,9 @@ void C::aMember() {}
)", R"(
#include "file.h"
// Member function comment
/**
* \brief Foo::aMember
*/
void C::aMember() {}
)"};
QTest::newRow("member function: from decl to def") << headersMemberDecl2Def
@@ -9405,13 +9409,17 @@ class C {
void aMember();
)", R"(
class C {
// Member function comment
/**
* \brief Foo::aMember
*/
void aMember();
)"};
const QByteArrayList sourcesMemberDef2Decl{R"(
#include "file.h"
// Member function comment
/**
* \brief Foo::aMember
*/
void C::aMember() {@}
)", R"(
#include "file.h"

View File

@@ -34,10 +34,13 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/editorconfiguration.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/projecttree.h>
#include <projectexplorer/projectmanager.h>
#include <texteditor/tabsettings.h>
#include <utils/algorithm.h>
#include <utils/basetreeview.h>
#include <utils/layoutbuilder.h>
@@ -9708,7 +9711,45 @@ private:
comments.first(), sourceFile->document());
const int sourceCommentEndPos = sourceTu->getTokenEndPositionInDocument(
comments.last(), sourceFile->document());
const QString functionDoc = sourceFile->textOf(sourceCommentStartPos, sourceCommentEndPos);
// Manually adjust indentation, as both our built-in indenter and ClangFormat
// are unreliable with regards to comment continuation lines.
auto tabSettings = [](CppRefactoringFilePtr file) {
if (auto editor = file->editor())
return editor->textDocument()->tabSettings();
return ProjectExplorer::actualTabSettings(file->filePath(), nullptr);
};
const TabSettings &sts = tabSettings(sourceFile);
const TabSettings &tts = tabSettings(targetFile);
const QTextBlock insertionBlock = targetFile->document()->findBlock(insertionPos);
const int insertionColumn = tts.columnAt(insertionBlock.text(),
insertionPos - insertionBlock.position());
const QTextBlock removalBlock = sourceFile->document()->findBlock(sourceCommentStartPos);
const QTextBlock removalBlockEnd = sourceFile->document()->findBlock(sourceCommentEndPos);
const int removalColumn = sts.columnAt(removalBlock.text(),
sourceCommentStartPos - removalBlock.position());
const int columnOffset = insertionColumn - removalColumn;
QString functionDoc;
if (columnOffset != 0) {
for (QTextBlock block = removalBlock;
block.isValid() && block != removalBlockEnd.next();
block = block.next()) {
QString text = block.text() + QChar::ParagraphSeparator;
if (block == removalBlockEnd)
text = text.left(sourceCommentEndPos - block.position());
if (block == removalBlock) {
text = text.mid(sourceCommentStartPos - block.position());
} else {
int lineIndentColumn = sts.indentationColumn(text) + columnOffset;
text.replace(0,
TabSettings::firstNonSpace(text),
tts.indentationString(0, lineIndentColumn, 0, insertionBlock));
}
functionDoc += text;
}
} else {
functionDoc = sourceFile->textOf(sourceCommentStartPos, sourceCommentEndPos);
}
// Remove comment plus leading and trailing whitespace, including trailing newline.
const auto removeAtSource = [&](ChangeSet &changeSet) {
@@ -9740,10 +9781,10 @@ private:
ChangeSet targetChangeSet;
targetChangeSet.insert(insertionPos, functionDoc);
targetChangeSet.insert(insertionPos, "\n");
targetChangeSet.insert(insertionPos, QString(insertionColumn, ' '));
if (targetFile == sourceFile)
removeAtSource(targetChangeSet);
targetFile->setChangeSet(targetChangeSet);
targetFile->appendIndentRange({insertionPos, insertionPos + int(functionDoc.length())});
const bool targetFileSuccess = targetFile->apply();
if (targetFile == sourceFile || !targetFileSuccess)
return;

View File

@@ -592,6 +592,11 @@ bool Client::reachable() const
return d->m_state == Initialized;
}
void Client::resetRestartCounter()
{
d->m_restartsLeft = ClientPrivate::MaxRestarts;
}
void Client::setClientInfo(const LanguageServerProtocol::ClientInfo &clientInfo)
{
d->m_clientInfo = clientInfo;

View File

@@ -86,6 +86,7 @@ public:
State state() const;
QString stateString() const;
bool reachable() const;
void resetRestartCounter();
void setClientInfo(const LanguageServerProtocol::ClientInfo &clientInfo);
// capabilities

View File

@@ -159,6 +159,7 @@ void LanguageClientManager::clientFinished(Client *client)
QTC_ASSERT(managerInstance, return);
if (managerInstance->m_restartingClients.remove(client)) {
client->resetRestartCounter();
client->reset();
client->start();
return;

View File

@@ -18,8 +18,6 @@ add_feature_info("ProjectStorage" ${USE_PROJECTSTORAGE} "")
add_qtc_library(QmlDesignerUtils STATIC
DEPENDS
Qt::Gui Utils Qt::QmlPrivate Core
DEFINES QMLDESIGNERUTILS_LIBRARY
PUBLIC_DEFINES $<$<BOOL:${QTC_STATIC_BUILD}>:QMLDESIGNER_STATIC_LIBRARY>
PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/utils
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/utils
@@ -69,8 +67,6 @@ add_qtc_library(QmlDesignerCore STATIC
TextEditor
Sqlite
DEFINES
QMLDESIGNERCORE_LIBRARY
QMLDESIGNERUTILS_LIBRARY
$<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE>
INCLUDES
${CMAKE_CURRENT_LIST_DIR}
@@ -443,7 +439,6 @@ add_qtc_plugin(QmlDesigner
IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\"
SHARE_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../../share/qtcreator/qmldesigner"
$<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE>
QMLDESIGNER_LIBRARY QMLDESIGNERCORE_LIBRARY QMLDESIGNERUTILS_LIBRARY
INCLUDES
${CMAKE_CURRENT_LIST_DIR}/components
${CMAKE_CURRENT_LIST_DIR}/components/assetslibrary

View File

@@ -7,6 +7,8 @@
#if defined(STUDIOWELCOME_LIBRARY)
# define STUDIOWELCOME_EXPORT Q_DECL_EXPORT
#elif defined(STUDIOWELCOME_STATIC_LIBRARY)
# define STUDIOWELCOME_EXPORT
#else
# define STUDIOWELCOME_EXPORT Q_DECL_IMPORT
#endif