clangbackendipcintegration.cpp 20.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company.  For licensing terms and
** conditions see http://www.qt.io/terms-conditions.  For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights.  These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/

31
#include "clangbackendipcintegration.h"
32

33
#include "clangcompletionassistprocessor.h"
Marco Bubke's avatar
Marco Bubke committed
34
#include "clangeditordocumentprocessor.h"
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
#include "clangmodelmanagersupport.h"
#include "clangutils.h"
#include "pchmanager.h"

#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>

#include <cpptools/abstracteditorsupport.h>
#include <cpptools/baseeditordocumentprocessor.h>
#include <cpptools/editordocumenthandle.h>

#include <texteditor/codeassist/functionhintproposal.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/texteditor.h>

Marco Bubke's avatar
Marco Bubke committed
50 51
#include <clangbackendipc/diagnosticschangedmessage.h>

52 53 54
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>

55 56 57
#include <clangbackendipc/cmbcodecompletedmessage.h>
#include <clangbackendipc/cmbcompletecodemessage.h>
#include <clangbackendipc/cmbechomessage.h>
58 59 60 61
#include <clangbackendipc/cmbregistertranslationunitsforeditormessage.h>
#include <clangbackendipc/cmbregisterprojectsforeditormessage.h>
#include <clangbackendipc/cmbunregistertranslationunitsforeditormessage.h>
#include <clangbackendipc/cmbunregisterprojectsforeditormessage.h>
62
#include <clangbackendipc/cmbmessages.h>
63
#include <clangbackendipc/registerunsavedfilesforeditormessage.h>
Marco Bubke's avatar
Marco Bubke committed
64 65
#include <clangbackendipc/requestdiagnosticsmessage.h>
#include <clangbackendipc/filecontainer.h>
66 67
#include <clangbackendipc/projectpartsdonotexistmessage.h>
#include <clangbackendipc/translationunitdoesnotexistmessage.h>
68
#include <clangbackendipc/unregisterunsavedfilesforeditormessage.h>
69 70 71 72 73 74 75 76 77 78 79 80

#include <cplusplus/Icons.h>

#include <QElapsedTimer>
#include <QLoggingCategory>
#include <QProcess>

static Q_LOGGING_CATEGORY(log, "qtc.clangcodemodel.ipc")

using namespace CPlusPlus;
using namespace ClangCodeModel;
using namespace ClangCodeModel::Internal;
81
using namespace ClangBackEnd;
82 83 84 85 86 87
using namespace TextEditor;

namespace {

QString backendProcessPath()
{
88
    return Core::ICore::libexecPath()
89
            + QStringLiteral("/clangbackend")
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
            + QStringLiteral(QTC_HOST_EXE_SUFFIX);
}

} // anonymous namespace

IpcReceiver::IpcReceiver()
{
}

IpcReceiver::~IpcReceiver()
{
    deleteAndClearWaitingAssistProcessors();
}

void IpcReceiver::setAliveHandler(const IpcReceiver::AliveHandler &handler)
{
    m_aliveHandler = handler;
}

109
void IpcReceiver::addExpectedCodeCompletedMessage(
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
        quint64 ticket,
        ClangCompletionAssistProcessor *processor)
{
    QTC_ASSERT(processor, return);
    QTC_CHECK(!m_assistProcessorsTable.contains(ticket));
    m_assistProcessorsTable.insert(ticket, processor);
}

void IpcReceiver::deleteAndClearWaitingAssistProcessors()
{
    qDeleteAll(m_assistProcessorsTable.begin(), m_assistProcessorsTable.end());
    m_assistProcessorsTable.clear();
}

void IpcReceiver::deleteProcessorsOfEditorWidget(TextEditor::TextEditorWidget *textEditorWidget)
{
    QMutableHashIterator<quint64, ClangCompletionAssistProcessor *> it(m_assistProcessorsTable);
    while (it.hasNext()) {
        it.next();
        ClangCompletionAssistProcessor *assistProcessor = it.value();
        if (assistProcessor->textEditorWidget() == textEditorWidget) {
            delete assistProcessor;
            it.remove();
        }
    }
}

void IpcReceiver::alive()
{
139
    qCDebug(log) << "<<< AliveMessage";
140 141 142 143
    QTC_ASSERT(m_aliveHandler, return);
    m_aliveHandler();
}

144
void IpcReceiver::echo(const EchoMessage &message)
145
{
146
    qCDebug(log) << "<<<" << message;
147 148
}

149
void IpcReceiver::codeCompleted(const CodeCompletedMessage &message)
150
{
151
    qCDebug(log) << "<<< CodeCompletedMessage with" << message.codeCompletions().size() << "items";
152

153
    const quint64 ticket = message.ticketNumber();
154
    QScopedPointer<ClangCompletionAssistProcessor> processor(m_assistProcessorsTable.take(ticket));
155
    if (processor) {
156
        const bool finished = processor->handleAvailableAsyncCompletions(message.codeCompletions());
157 158 159
        if (!finished)
            processor.take();
    }
160 161
}

Marco Bubke's avatar
Marco Bubke committed
162 163 164 165 166 167 168 169 170 171
void IpcReceiver::diagnosticsChanged(const DiagnosticsChangedMessage &message)
{
    qCDebug(log) << "<<< DiagnosticsChangedMessage with" << message.diagnostics().size() << "items";

    auto processor = ClangEditorDocumentProcessor::get(message.file().filePath());

    if (processor && processor->projectPart()) {
        const QString diagnosticsProjectPartId = message.file().projectPartId();
        const QString documentProjectPartId = processor->projectPart()->id();
        if (diagnosticsProjectPartId == documentProjectPartId)
172
            processor->updateCodeWarnings(message.diagnostics(), message.file().documentRevision());
Marco Bubke's avatar
Marco Bubke committed
173 174 175
    }
}

176
void IpcReceiver::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
177
{
178 179
    QTC_CHECK(!"Got TranslationUnitDoesNotExistMessage");
    qCDebug(log) << "<<< ERROR:" << message;
180 181
}

182
void IpcReceiver::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
183
{
184 185
    QTC_CHECK(!"Got ProjectPartsDoNotExistMessage");
    qCDebug(log) << "<<< ERROR:" << message;
186 187 188 189 190
}

class IpcSender : public IpcSenderInterface
{
public:
191
    IpcSender(ClangBackEnd::ConnectionClient &connectionClient)
192 193 194 195
        : m_connection(connectionClient)
    {}

    void end() override;
196 197 198 199
    void registerTranslationUnitsForEditor(const ClangBackEnd::RegisterTranslationUnitForEditorMessage &message) override;
    void unregisterTranslationUnitsForEditor(const ClangBackEnd::UnregisterTranslationUnitsForEditorMessage &message) override;
    void registerProjectPartsForEditor(const ClangBackEnd::RegisterProjectPartsForEditorMessage &message) override;
    void unregisterProjectPartsForEditor(const ClangBackEnd::UnregisterProjectPartsForEditorMessage &message) override;
200 201
    void registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message) override;
    void unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message) override;
202
    void completeCode(const ClangBackEnd::CompleteCodeMessage &message) override;
Marco Bubke's avatar
Marco Bubke committed
203
    void requestDiagnostics(const ClangBackEnd::RequestDiagnosticsMessage &message) override;
204 205

private:
206
    ClangBackEnd::ConnectionClient &m_connection;
207 208 209 210 211
};

void IpcSender::end()
{
     QTC_CHECK(m_connection.isConnected());
212
     m_connection.sendEndMessage();
213 214
}

215
void IpcSender::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
216 217
{
     QTC_CHECK(m_connection.isConnected());
218
     m_connection.serverProxy().registerTranslationUnitsForEditor(message);
219 220
}

221
void IpcSender::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
222 223
{
     QTC_CHECK(m_connection.isConnected());
224
     m_connection.serverProxy().unregisterTranslationUnitsForEditor(message);
225 226
}

227
void IpcSender::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
228 229
{
     QTC_CHECK(m_connection.isConnected());
230
     m_connection.serverProxy().registerProjectPartsForEditor(message);
231 232
}

233
void IpcSender::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
234 235
{
     QTC_CHECK(m_connection.isConnected());
236
     m_connection.serverProxy().unregisterProjectPartsForEditor(message);
237 238
}

239 240 241 242 243 244 245 246 247 248 249 250
void IpcSender::registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message)
{
    QTC_CHECK(m_connection.isConnected());
    m_connection.serverProxy().registerUnsavedFilesForEditor(message);
}

void IpcSender::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message)
{
    QTC_CHECK(m_connection.isConnected());
    m_connection.serverProxy().unregisterUnsavedFilesForEditor(message);
}

251
void IpcSender::completeCode(const CompleteCodeMessage &message)
252 253
{
     QTC_CHECK(m_connection.isConnected());
254
     m_connection.serverProxy().completeCode(message);
255 256
}

Marco Bubke's avatar
Marco Bubke committed
257 258 259 260 261 262
void IpcSender::requestDiagnostics(const RequestDiagnosticsMessage &message)
{
    QTC_CHECK(m_connection.isConnected());
    m_connection.serverProxy().requestDiagnostics(message);
}

263 264 265 266 267 268 269 270
IpcCommunicator::IpcCommunicator()
    : m_connection(&m_ipcReceiver)
    , m_ipcSender(new IpcSender(m_connection))
{
    m_ipcReceiver.setAliveHandler([this]() { m_connection.resetProcessAliveTimer(); });

    connect(Core::EditorManager::instance(), &Core::EditorManager::editorAboutToClose,
            this, &IpcCommunicator::onEditorAboutToClose);
271 272
    connect(Core::ICore::instance(), &Core::ICore::coreAboutToClose,
            this, &IpcCommunicator::onCoreAboutToClose);
273 274 275 276

    initializeBackend();
}

277
static bool areMessagesRegistered = false;
278 279 280

void IpcCommunicator::initializeBackend()
{
281 282 283
    if (!areMessagesRegistered) {
        areMessagesRegistered = true;
        Messages::registerMessages();
284 285
    }

286 287 288
    const QString clangBackEndProcessPath = backendProcessPath();
    qCDebug(log) << "Starting" << clangBackEndProcessPath;
    QTC_ASSERT(QFileInfo(clangBackEndProcessPath).exists(), return);
289

290
    m_connection.setProcessAliveTimerInterval(30 * 1000);
291
    m_connection.setProcessPath(clangBackEndProcessPath);
292 293 294 295

    connect(&m_connection, &ConnectionClient::processRestarted,
            this, &IpcCommunicator::onBackendRestarted);

296 297
    // TODO: Add a asynchron API to ConnectionClient, otherwise we might hang here
    if (m_connection.connectToServer())
298 299 300 301 302 303
        initializeBackendWithCurrentData();
}

void IpcCommunicator::registerEmptyProjectForProjectLessFiles()
{
    QTC_CHECK(m_connection.isConnected());
304
    registerProjectPartsForEditor({ClangBackEnd::ProjectPartContainer(
305 306 307 308 309 310 311 312 313 314 315 316 317
                                           Utf8String(),
                                           Utf8StringVector())});
}

void IpcCommunicator::registerCurrentProjectParts()
{
    using namespace CppTools;

    const QList<ProjectInfo> projectInfos = CppModelManager::instance()->projectInfos();
    foreach (const ProjectInfo &projectInfo, projectInfos)
        registerProjectsParts(projectInfo.projectParts());
}

318
void IpcCommunicator::registerCurrentCppEditorDocuments()
319 320 321 322 323 324
{
    using namespace CppTools;

    const auto cppEditorDocuments = CppModelManager::instance()->cppEditorDocuments();
    foreach (const CppEditorDocumentHandle *cppEditorDocument, cppEditorDocuments) {
        if (cppEditorDocument->processor()->baseTextDocument()->isModified())
325
            updateTranslationUnitFromCppEditorDocument(cppEditorDocument->filePath());
326 327 328 329 330 331 332 333 334
    }
}

void IpcCommunicator::registerCurrrentCodeModelUiHeaders()
{
    using namespace CppTools;

    const auto editorSupports = CppModelManager::instance()->abstractEditorSupports();
    foreach (const AbstractEditorSupport *es, editorSupports)
335
        updateUnsavedFile(es->fileName(), es->contents(), es->revision());
336 337
}

338
static QStringList projectPartMessageLine(const CppTools::ProjectPart::Ptr &projectPart)
339 340 341 342 343
{
    QStringList options = ClangCodeModel::Utils::createClangOptions(projectPart,
        CppTools::ProjectFile::Unclassified); // No language option
    if (PchInfo::Ptr pchInfo = PchManager::instance()->pchInfo(projectPart))
        options += ClangCodeModel::Utils::createPCHInclusionOptions(pchInfo->fileName());
Marco Bubke's avatar
Marco Bubke committed
344

345 346 347
    return options;
}

348
static ClangBackEnd::ProjectPartContainer toProjectPartContainer(
349 350
        const CppTools::ProjectPart::Ptr &projectPart)
{
351
    const QStringList arguments = projectPartMessageLine(projectPart);
352
    return ClangBackEnd::ProjectPartContainer(projectPart->id(), Utf8StringVector(arguments));
353 354
}

355
static QVector<ClangBackEnd::ProjectPartContainer> toProjectPartContainers(
356 357
        const QList<CppTools::ProjectPart::Ptr> projectParts)
{
358
    QVector<ClangBackEnd::ProjectPartContainer> projectPartContainers;
359 360 361 362 363 364 365 366 367
    projectPartContainers.reserve(projectParts.size());
    foreach (const CppTools::ProjectPart::Ptr &projectPart, projectParts)
        projectPartContainers << toProjectPartContainer(projectPart);
    return projectPartContainers;
}

void IpcCommunicator::registerProjectsParts(const QList<CppTools::ProjectPart::Ptr> projectParts)
{
    const auto projectPartContainers = toProjectPartContainers(projectParts);
368
    registerProjectPartsForEditor(projectPartContainers);
369 370
}

371 372 373 374 375 376 377
void IpcCommunicator::updateTranslationUnitFromCppEditorDocument(const QString &filePath)
{
    const auto document = CppTools::CppModelManager::instance()->cppEditorDocument(filePath);

    updateTranslationUnit(filePath, document->contents(), document->revision());
}

378 379
void IpcCommunicator::updateUnsavedFileFromCppEditorDocument(const QString &filePath)
{
380 381 382
    const auto document = CppTools::CppModelManager::instance()->cppEditorDocument(filePath);

    updateUnsavedFile(filePath, document->contents(), document->revision());
383 384
}

385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
namespace {
CppTools::CppEditorDocumentHandle *cppDocument(const QString &filePath)
{
    return CppTools::CppModelManager::instance()->cppEditorDocument(filePath);
}

bool documentHasChanged(const QString &filePath, const QString &projectPartId)
{
    auto *document = cppDocument(filePath);

    if (document)
        return document->sendTracker(projectPartId).shouldSendRevision(document->revision());

    return true;
}

void setLastSentDocumentRevision(const QString &filePath,
                                 const QString &projectPartId,
                                 uint revision)
{
    auto *document = cppDocument(filePath);

    if (document)
        document->sendTracker(projectPartId).setLastSentRevision(int(revision));
}
}

412
void IpcCommunicator::updateTranslationUnit(const QString &filePath,
413 414
                                        const QByteArray &contents,
                                        uint documentRevision)
415
{
416
    const QString projectPartId = Utils::projectPartIdForFile(filePath);
417

418 419 420 421 422 423 424 425 426 427 428
    if (documentHasChanged(filePath, projectPartId)) {
        const bool hasUnsavedContent = true;

        registerTranslationUnitsForEditor({{filePath,
                                            projectPartId,
                                            Utf8String::fromByteArray(contents),
                                            hasUnsavedContent,
                                            documentRevision}});

        setLastSentDocumentRevision(filePath, projectPartId, documentRevision);
    }
429 430 431 432 433 434 435 436 437 438 439 440 441
}

void IpcCommunicator::updateUnsavedFile(const QString &filePath, const QByteArray &contents, uint documentRevision)
{
    const QString projectPartId = Utils::projectPartIdForFile(filePath);
    const bool hasUnsavedContent = true;

    // TODO: Send new only if changed
    registerUnsavedFilesForEditor({{filePath,
                                    projectPartId,
                                    Utf8String::fromByteArray(contents),
                                    hasUnsavedContent,
                                    documentRevision}});
Marco Bubke's avatar
Marco Bubke committed
442 443
}

444
void IpcCommunicator::requestDiagnostics(const FileContainer &fileContainer)
Marco Bubke's avatar
Marco Bubke committed
445
{
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
    if (documentHasChanged(fileContainer.filePath(), fileContainer.projectPartId())) {
        registerTranslationUnitsForEditor({fileContainer});
        m_ipcSender->requestDiagnostics({fileContainer});
        setLastSentDocumentRevision(fileContainer.filePath(),
                                    fileContainer.projectPartId(),
                                    fileContainer.documentRevision());
    }
}

void IpcCommunicator::updateChangeContentStartPosition(const QString &filePath, int position)
{
    auto *document = cppDocument(filePath);

    if (document) {
        const QString projectPartId = Utils::projectPartIdForFile(filePath);
        document->sendTracker(projectPartId).applyContentChange(position);
    }
463 464
}

465
void IpcCommunicator::updateTranslationUnitIfNotCurrentDocument(Core::IDocument *document)
466 467 468
{
    QTC_ASSERT(document, return);
    if (Core::EditorManager::currentDocument() != document)
469 470 471 472 473 474 475 476
        updateTranslationUnitFromCppEditorDocument(document->filePath().toString());
}

void IpcCommunicator::updateUnsavedFile(Core::IDocument *document)
{
    QTC_ASSERT(document, return);

     updateUnsavedFileFromCppEditorDocument(document->filePath().toString());
477 478 479 480
}

void IpcCommunicator::onBackendRestarted()
{
481
    qWarning("Clang back end finished unexpectedly, restarted.");
482 483 484 485 486 487 488 489 490 491 492 493
    qCDebug(log) << "Backend restarted, re-initializing with project data and unsaved files.";

    m_ipcReceiver.deleteAndClearWaitingAssistProcessors();
    initializeBackendWithCurrentData();
}

void IpcCommunicator::onEditorAboutToClose(Core::IEditor *editor)
{
    if (auto *textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor))
        m_ipcReceiver.deleteProcessorsOfEditorWidget(textEditor->editorWidget());
}

494 495 496 497 498
void IpcCommunicator::onCoreAboutToClose()
{
    m_sendMode = IgnoreSendRequests;
}

499 500 501 502
void IpcCommunicator::initializeBackendWithCurrentData()
{
    registerEmptyProjectForProjectLessFiles();
    registerCurrentProjectParts();
503
    registerCurrentCppEditorDocuments();
504 505 506 507 508 509 510
    registerCurrrentCodeModelUiHeaders();

    emit backendReinitialized();
}

IpcSenderInterface *IpcCommunicator::setIpcSender(IpcSenderInterface *ipcSender)
{
511
    IpcSenderInterface *previousMessageSender = m_ipcSender.take();
512
    m_ipcSender.reset(ipcSender);
513
    return previousMessageSender;
514 515 516 517 518 519 520
}

void IpcCommunicator::killBackendProcess()
{
    m_connection.processForTestOnly()->kill();
}

521
void IpcCommunicator::registerTranslationUnitsForEditor(const FileContainers &fileContainers)
522 523 524 525
{
    if (m_sendMode == IgnoreSendRequests)
        return;

526
    const RegisterTranslationUnitForEditorMessage message(fileContainers);
527
    qCDebug(log) << ">>>" << message;
528
    m_ipcSender->registerTranslationUnitsForEditor(message);
529 530
}

531
void IpcCommunicator::unregisterTranslationUnitsForEditor(const FileContainers &fileContainers)
532 533 534 535
{
    if (m_sendMode == IgnoreSendRequests)
        return;

536
    const UnregisterTranslationUnitsForEditorMessage message(fileContainers);
537
    qCDebug(log) << ">>>" << message;
538
    m_ipcSender->unregisterTranslationUnitsForEditor(message);
539 540
}

541
void IpcCommunicator::registerProjectPartsForEditor(
542 543 544 545 546
        const ProjectPartContainers &projectPartContainers)
{
    if (m_sendMode == IgnoreSendRequests)
        return;

547
    const RegisterProjectPartsForEditorMessage message(projectPartContainers);
548
    qCDebug(log) << ">>>" << message;
549
    m_ipcSender->registerProjectPartsForEditor(message);
550 551
}

552
void IpcCommunicator::unregisterProjectPartsForEditor(const QStringList &projectPartIds)
553 554 555 556
{
    if (m_sendMode == IgnoreSendRequests)
        return;

557
    const UnregisterProjectPartsForEditorMessage message((Utf8StringVector(projectPartIds)));
558
    qCDebug(log) << ">>>" << message;
559
    m_ipcSender->unregisterProjectPartsForEditor(message);
560 561
}

562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
void IpcCommunicator::registerUnsavedFilesForEditor(const IpcCommunicator::FileContainers &fileContainers)
{
    if (m_sendMode == IgnoreSendRequests)
        return;

    const RegisterUnsavedFilesForEditorMessage message(fileContainers);
    qCDebug(log) << ">>>" << message;
    m_ipcSender->registerUnsavedFilesForEditor(message);
}

void IpcCommunicator::unregisterUnsavedFilesForEditor(const IpcCommunicator::FileContainers &fileContainers)
{
    if (m_sendMode == IgnoreSendRequests)
        return;

    const UnregisterUnsavedFilesForEditorMessage message(fileContainers);
    qCDebug(log) << ">>>" << message;
    m_ipcSender->unregisterUnsavedFilesForEditor(message);
}

582
void IpcCommunicator::completeCode(ClangCompletionAssistProcessor *assistProcessor,
583 584 585 586
                                   const QString &filePath,
                                   quint32 line,
                                   quint32 column,
                                   const QString &projectFilePath)
587 588 589 590
{
    if (m_sendMode == IgnoreSendRequests)
        return;

591 592 593 594
    const CompleteCodeMessage message(filePath, line, column, projectFilePath);
    qCDebug(log) << ">>>" << message;
    m_ipcSender->completeCode(message);
    m_ipcReceiver.addExpectedCodeCompletedMessage(message.ticketNumber(), assistProcessor);
595
}