diff options
Diffstat (limited to 'src/app/qbs/session.cpp')
-rw-r--r-- | src/app/qbs/session.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/app/qbs/session.cpp b/src/app/qbs/session.cpp index 5a1fe145d..2cdcf2b63 100644 --- a/src/app/qbs/session.cpp +++ b/src/app/qbs/session.cpp @@ -39,6 +39,7 @@ #include "session.h" +#include "lspserver.h" #include "sessionpacket.h" #include "sessionpacketreader.h" @@ -66,7 +67,6 @@ #include <QtCore/qobject.h> #include <QtCore/qprocess.h> -#include <algorithm> #include <cstdlib> #include <iostream> #include <memory> @@ -166,6 +166,7 @@ private: FileUpdateData prepareFileUpdate(const QJsonObject &request); SessionPacketReader m_packetReader; + LspServer m_lspServer; Project m_project; ProjectData m_projectData; SessionLogSink m_logSink; @@ -193,7 +194,7 @@ Session::Session() qApp->exit(EXIT_FAILURE); } #endif - sendPacket(SessionPacket::helloMessage()); + sendPacket(SessionPacket::helloMessage(m_lspServer.socketPath())); connect(&m_logSink, &SessionLogSink::newMessage, this, &Session::sendPacket); connect(&m_packetReader, &SessionPacketReader::errorOccurred, this, [](const QString &msg) { @@ -287,6 +288,7 @@ void Session::setupProject(const QJsonObject &request) const ProjectData oldProjectData = m_projectData; m_project = setupJob->project(); m_projectData = m_project.projectData(); + m_lspServer.updateProjectData(m_projectData, m_project.codeLinks()); QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("project-resolved")); if (success) @@ -554,7 +556,7 @@ void Session::getGeneratedFilesForSources(const QJsonObject &request) reply.insert(StringConstants::type(), QLatin1String(replyType)); const QJsonArray specs = request.value(StringConstants::productsKey()).toArray(); QJsonArray resultProducts; - for (const QJsonValue &p : specs) { + for (const auto &p : specs) { const QJsonObject productObject = p.toObject(); const ProductData product = getProductByName( productObject.value(StringConstants::fullDisplayNameKey()).toString()); @@ -564,7 +566,7 @@ void Session::getGeneratedFilesForSources(const QJsonObject &request) resultProduct.insert(StringConstants::fullDisplayNameKey(), product.fullDisplayName()); QJsonArray results; const QJsonArray requests = productObject.value(QLatin1String("requests")).toArray(); - for (const QJsonValue &r : requests) { + for (const auto &r : requests) { const QJsonObject request = r.toObject(); const QString filePath = request.value(QLatin1String("source-file")).toString(); const QStringList tags = fromJson<QStringList>(request.value(QLatin1String("tags"))); @@ -621,10 +623,11 @@ Session::ProductSelection Session::getProductSelection(const QJsonObject &reques { const QJsonValue productSelection = request.value(StringConstants::productsKey()); if (productSelection.isArray()) - return ProductSelection(getProductsByName(fromJson<QStringList>(productSelection))); - return ProductSelection(productSelection.toString() == QLatin1String("all") - ? Project::ProductSelectionWithNonDefault - : Project::ProductSelectionDefaultOnly); + return {getProductsByName(fromJson<QStringList>(productSelection))}; + return { + productSelection.toString() == QLatin1String("all") + ? Project::ProductSelectionWithNonDefault + : Project::ProductSelectionDefaultOnly}; } Session::FileUpdateData Session::prepareFileUpdate(const QJsonObject &request) @@ -646,7 +649,7 @@ Session::FileUpdateData Session::prepareFileUpdate(const QJsonObject &request) data.error = tr("Product '%1' not found in project.").arg(productName); } const QJsonArray filesArray = request.value(QLatin1String("files")).toArray(); - for (const QJsonValue &v : filesArray) + for (const auto &v : filesArray) data.filePaths << v.toString(); if (m_currentJob) data.error = tr("Cannot update the list of source files while a job is running."); |