forked from qt-creator/qt-creator
ClangCodeModel: Remove backend communication facilities
Change-Id: I3d10b33cb641a49e8b79272d754fbeece23fb249 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -11,10 +11,6 @@ add_qtc_plugin(ClangCodeModel
|
||||
SOURCES
|
||||
clangactivationsequencecontextprocessor.cpp clangactivationsequencecontextprocessor.h
|
||||
clangactivationsequenceprocessor.cpp clangactivationsequenceprocessor.h
|
||||
clangbackendcommunicator.cpp clangbackendcommunicator.h
|
||||
clangbackendlogging.cpp clangbackendlogging.h
|
||||
clangbackendreceiver.cpp clangbackendreceiver.h
|
||||
clangbackendsender.cpp clangbackendsender.h
|
||||
clangcodemodelplugin.cpp clangcodemodelplugin.h
|
||||
clangcompletioncontextanalyzer.cpp clangcompletioncontextanalyzer.h
|
||||
clangconstants.h
|
||||
|
@@ -1,433 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: https://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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "clangbackendcommunicator.h"
|
||||
|
||||
#include "clangbackendlogging.h"
|
||||
#include "clangmodelmanagersupport.h"
|
||||
#include "clangutils.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
|
||||
#include <cppeditor/abstracteditorsupport.h>
|
||||
#include <cppeditor/baseeditordocumentprocessor.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <cppeditor/editordocumenthandle.h>
|
||||
#include <cppeditor/projectinfo.h>
|
||||
|
||||
#include <texteditor/codeassist/functionhintproposal.h>
|
||||
#include <texteditor/codeassist/iassistprocessor.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
|
||||
#include <clangsupport/filecontainer.h>
|
||||
#include <clangsupport/clangcodemodelservermessages.h>
|
||||
|
||||
#include <utils/globalfilechangeblocker.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QTextBlock>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace ClangBackEnd;
|
||||
using namespace TextEditor;
|
||||
using namespace Utils;
|
||||
|
||||
enum { backEndStartTimeOutInMs = 10000 };
|
||||
|
||||
static QString backendProcessPath()
|
||||
{
|
||||
return Core::ICore::libexecPath("clangbackend" QTC_HOST_EXE_SUFFIX).toString();
|
||||
}
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
class DummyBackendSender : public ClangBackEnd::ClangCodeModelServerInterface
|
||||
{
|
||||
public:
|
||||
void end() override {}
|
||||
|
||||
void documentsOpened(const DocumentsOpenedMessage &) override {}
|
||||
void documentsChanged(const DocumentsChangedMessage &) override {}
|
||||
void documentsClosed(const DocumentsClosedMessage &) override {}
|
||||
void documentVisibilityChanged(const DocumentVisibilityChangedMessage &) override {}
|
||||
|
||||
void unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &) override {}
|
||||
void unsavedFilesRemoved(const UnsavedFilesRemovedMessage &) override {}
|
||||
|
||||
void requestCompletions(const RequestCompletionsMessage &) override {}
|
||||
void requestAnnotations(const RequestAnnotationsMessage &) override {}
|
||||
void requestReferences(const RequestReferencesMessage &) override {}
|
||||
void requestFollowSymbol(const RequestFollowSymbolMessage &) override {}
|
||||
void requestToolTip(const RequestToolTipMessage &) override {}
|
||||
};
|
||||
|
||||
BackendCommunicator::BackendCommunicator()
|
||||
: m_connection(&m_receiver)
|
||||
, m_sender(new DummyBackendSender())
|
||||
{
|
||||
m_backendStartTimeOut.setSingleShot(true);
|
||||
connect(&m_backendStartTimeOut, &QTimer::timeout,
|
||||
this, &BackendCommunicator::logStartTimeOut);
|
||||
|
||||
m_receiver.setAliveHandler([this]() { m_connection.resetProcessAliveTimer(); });
|
||||
|
||||
connect(Core::ICore::instance(), &Core::ICore::coreAboutToClose,
|
||||
this, &BackendCommunicator::setupDummySender);
|
||||
auto globalFCB = GlobalFileChangeBlocker::instance();
|
||||
m_postponeBackendJobs = globalFCB->isBlocked();
|
||||
connect(globalFCB, &GlobalFileChangeBlocker::stateChanged,
|
||||
this, &BackendCommunicator::setBackendJobsPostponed);
|
||||
|
||||
initializeBackend();
|
||||
}
|
||||
|
||||
BackendCommunicator::~BackendCommunicator()
|
||||
{
|
||||
disconnect(&m_connection, nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
void BackendCommunicator::initializeBackend()
|
||||
{
|
||||
const QString clangBackEndProcessPath = backendProcessPath();
|
||||
if (!QFileInfo::exists(clangBackEndProcessPath)) {
|
||||
logExecutableDoesNotExist();
|
||||
return;
|
||||
}
|
||||
qCDebug(ipcLog) << "Starting" << clangBackEndProcessPath;
|
||||
|
||||
m_connection.setProcessAliveTimerInterval(30 * 1000);
|
||||
m_connection.setProcessPath(clangBackEndProcessPath);
|
||||
|
||||
connect(&m_connection, &ConnectionClient::connectedToLocalSocket,
|
||||
this, &BackendCommunicator::onConnectedToBackend);
|
||||
connect(&m_connection, &ConnectionClient::disconnectedFromLocalSocket,
|
||||
this, &BackendCommunicator::setupDummySender);
|
||||
|
||||
m_connection.startProcessAndConnectToServerAsynchronously();
|
||||
m_backendStartTimeOut.start(backEndStartTimeOutInMs);
|
||||
}
|
||||
|
||||
namespace {
|
||||
void removeDuplicates(Utf8StringVector &visibleEditorDocumentsFilePaths)
|
||||
{
|
||||
std::sort(visibleEditorDocumentsFilePaths.begin(),
|
||||
visibleEditorDocumentsFilePaths.end());
|
||||
const auto end = std::unique(visibleEditorDocumentsFilePaths.begin(),
|
||||
visibleEditorDocumentsFilePaths.end());
|
||||
visibleEditorDocumentsFilePaths.erase(end,
|
||||
visibleEditorDocumentsFilePaths.end());
|
||||
}
|
||||
|
||||
void removeNonCppEditors(QList<Core::IEditor*> &visibleEditors)
|
||||
{
|
||||
const auto isNotCppEditor = [] (Core::IEditor *editor) {
|
||||
return !CppEditor::CppModelManager::isCppEditor(editor);
|
||||
};
|
||||
|
||||
const auto end = std::remove_if(visibleEditors.begin(),
|
||||
visibleEditors.end(),
|
||||
isNotCppEditor);
|
||||
|
||||
visibleEditors.erase(end, visibleEditors.end());
|
||||
}
|
||||
|
||||
Utf8StringVector visibleCppEditorDocumentsFilePaths()
|
||||
{
|
||||
auto visibleEditors = Core::EditorManager::visibleEditors();
|
||||
|
||||
removeNonCppEditors(visibleEditors);
|
||||
|
||||
Utf8StringVector visibleCppEditorDocumentsFilePaths;
|
||||
visibleCppEditorDocumentsFilePaths.reserve(visibleEditors.size());
|
||||
|
||||
const auto editorFilePaths = [] (Core::IEditor *editor) {
|
||||
return Utf8String(editor->document()->filePath().toString());
|
||||
};
|
||||
|
||||
std::transform(visibleEditors.begin(),
|
||||
visibleEditors.end(),
|
||||
std::back_inserter(visibleCppEditorDocumentsFilePaths),
|
||||
editorFilePaths);
|
||||
|
||||
removeDuplicates(visibleCppEditorDocumentsFilePaths);
|
||||
|
||||
return visibleCppEditorDocumentsFilePaths;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentVisibilityChanged()
|
||||
{
|
||||
documentVisibilityChanged(currentCppEditorDocumentFilePath(),
|
||||
visibleCppEditorDocumentsFilePaths());
|
||||
}
|
||||
|
||||
void BackendCommunicator::setBackendJobsPostponed(bool postponed)
|
||||
{
|
||||
if (postponed) {
|
||||
documentVisibilityChanged(Utf8String(), {});
|
||||
m_postponeBackendJobs = postponed;
|
||||
} else {
|
||||
m_postponeBackendJobs = postponed;
|
||||
documentVisibilityChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentVisibilityChanged(const Utf8String ¤tEditorFilePath,
|
||||
const Utf8StringVector &visibleEditorsFilePaths)
|
||||
{
|
||||
if (m_postponeBackendJobs)
|
||||
return;
|
||||
|
||||
const DocumentVisibilityChangedMessage message(currentEditorFilePath, visibleEditorsFilePaths);
|
||||
m_sender->documentVisibilityChanged(message);
|
||||
}
|
||||
|
||||
void BackendCommunicator::restoreCppEditorDocuments()
|
||||
{
|
||||
resetCppEditorDocumentProcessors();
|
||||
CppEditor::CppModelManager::instance()->updateCppEditorDocuments();
|
||||
}
|
||||
|
||||
void BackendCommunicator::resetCppEditorDocumentProcessors()
|
||||
{
|
||||
using namespace CppEditor;
|
||||
|
||||
const auto cppEditorDocuments = CppModelManager::instance()->cppEditorDocuments();
|
||||
foreach (CppEditorDocumentHandle *cppEditorDocument, cppEditorDocuments)
|
||||
cppEditorDocument->resetProcessor();
|
||||
}
|
||||
|
||||
void BackendCommunicator::unsavedFilesUpdatedForUiHeaders()
|
||||
{
|
||||
using namespace CppEditor;
|
||||
|
||||
const auto editorSupports = CppModelManager::instance()->abstractEditorSupports();
|
||||
foreach (const AbstractEditorSupport *es, editorSupports) {
|
||||
const QString mappedPath
|
||||
= ClangModelManagerSupport::instance()->dummyUiHeaderOnDiskPath(es->fileName());
|
||||
unsavedFilesUpdated(mappedPath, es->contents(), es->revision());
|
||||
}
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsChangedFromCppEditorDocument(const QString &filePath)
|
||||
{
|
||||
const CppEditor::CppEditorDocumentHandle *document = cppDocument(filePath);
|
||||
QTC_ASSERT(document, return);
|
||||
documentsChanged(filePath, document->contents(), document->revision());
|
||||
}
|
||||
|
||||
void BackendCommunicator::unsavedFilesUpdatedFromCppEditorDocument(const QString &filePath)
|
||||
{
|
||||
const CppEditor::CppEditorDocumentHandle *document = cppDocument(filePath);
|
||||
QTC_ASSERT(document, return);
|
||||
unsavedFilesUpdated(filePath, document->contents(), document->revision());
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsChanged(const QString &filePath,
|
||||
const QByteArray &contents,
|
||||
uint documentRevision)
|
||||
{
|
||||
const bool hasUnsavedContent = true;
|
||||
|
||||
documentsChanged({{filePath,
|
||||
Utf8String::fromByteArray(contents),
|
||||
hasUnsavedContent,
|
||||
documentRevision}});
|
||||
}
|
||||
|
||||
void BackendCommunicator::unsavedFilesUpdated(const QString &filePath,
|
||||
const QByteArray &contents,
|
||||
uint documentRevision)
|
||||
{
|
||||
const bool hasUnsavedContent = true;
|
||||
|
||||
// TODO: Send new only if changed
|
||||
unsavedFilesUpdated({{filePath,
|
||||
Utf8String::fromByteArray(contents),
|
||||
hasUnsavedContent,
|
||||
documentRevision}});
|
||||
}
|
||||
|
||||
static bool documentHasChanged(const QString &filePath, uint revision)
|
||||
{
|
||||
if (CppEditor::CppEditorDocumentHandle *document = cppDocument(filePath))
|
||||
return document->sendTracker().shouldSendRevision(revision);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsChangedWithRevisionCheck(const FileContainer &fileContainer)
|
||||
{
|
||||
if (documentHasChanged(fileContainer.filePath, fileContainer.documentRevision)) {
|
||||
documentsChanged({fileContainer});
|
||||
setLastSentDocumentRevision(fileContainer.filePath,
|
||||
fileContainer.documentRevision);
|
||||
}
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsChangedWithRevisionCheck(Core::IDocument *document)
|
||||
{
|
||||
const auto textDocument = qobject_cast<TextDocument*>(document);
|
||||
const auto filePath = textDocument->filePath().toString();
|
||||
|
||||
documentsChangedWithRevisionCheck(
|
||||
FileContainer(filePath, {}, {}, textDocument->document()->revision()));
|
||||
}
|
||||
|
||||
void BackendCommunicator::updateChangeContentStartPosition(const QString &filePath, int position)
|
||||
{
|
||||
if (CppEditor::CppEditorDocumentHandle *document = cppDocument(filePath))
|
||||
document->sendTracker().applyContentChange(position);
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsChangedIfNotCurrentDocument(Core::IDocument *document)
|
||||
{
|
||||
QTC_ASSERT(document, return);
|
||||
if (Core::EditorManager::currentDocument() != document)
|
||||
documentsChanged(document);
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsChanged(Core::IDocument *document)
|
||||
{
|
||||
documentsChangedFromCppEditorDocument(document->filePath().toString());
|
||||
}
|
||||
|
||||
void BackendCommunicator::unsavedFilesUpdated(Core::IDocument *document)
|
||||
{
|
||||
QTC_ASSERT(document, return);
|
||||
|
||||
unsavedFilesUpdatedFromCppEditorDocument(document->filePath().toString());
|
||||
}
|
||||
|
||||
void BackendCommunicator::onConnectedToBackend()
|
||||
{
|
||||
m_backendStartTimeOut.stop();
|
||||
|
||||
++m_connectedCount;
|
||||
if (m_connectedCount > 1)
|
||||
logRestartedDueToUnexpectedFinish();
|
||||
|
||||
m_receiver.reset();
|
||||
m_sender.reset(new BackendSender(&m_connection));
|
||||
|
||||
initializeBackendWithCurrentData();
|
||||
}
|
||||
|
||||
void BackendCommunicator::setupDummySender()
|
||||
{
|
||||
m_sender.reset(new DummyBackendSender);
|
||||
}
|
||||
|
||||
void BackendCommunicator::logExecutableDoesNotExist()
|
||||
{
|
||||
const QString msg
|
||||
= tr("Clang Code Model: Error: "
|
||||
"The clangbackend executable \"%1\" does not exist.")
|
||||
.arg(QDir::toNativeSeparators(backendProcessPath()));
|
||||
|
||||
logError(msg);
|
||||
}
|
||||
|
||||
void BackendCommunicator::logStartTimeOut()
|
||||
{
|
||||
const QString msg
|
||||
= tr("Clang Code Model: Error: "
|
||||
"The clangbackend executable \"%1\" could not be started (timeout after %2ms).")
|
||||
.arg(QDir::toNativeSeparators(backendProcessPath()))
|
||||
.arg(backEndStartTimeOutInMs);
|
||||
|
||||
logError(msg);
|
||||
}
|
||||
|
||||
void BackendCommunicator::logRestartedDueToUnexpectedFinish()
|
||||
{
|
||||
const QString msg
|
||||
= tr("Clang Code Model: Error: "
|
||||
"The clangbackend process has finished unexpectedly and was restarted.");
|
||||
|
||||
logError(msg);
|
||||
}
|
||||
|
||||
void BackendCommunicator::logError(const QString &text)
|
||||
{
|
||||
const QString textWithTimestamp = QDateTime::currentDateTime().toString(Qt::ISODate)
|
||||
+ ' ' + text;
|
||||
Core::MessageManager::writeFlashing(textWithTimestamp);
|
||||
qWarning("%s", qPrintable(textWithTimestamp));
|
||||
}
|
||||
|
||||
void BackendCommunicator::initializeBackendWithCurrentData()
|
||||
{
|
||||
unsavedFilesUpdatedForUiHeaders();
|
||||
restoreCppEditorDocuments();
|
||||
documentVisibilityChanged();
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsOpened(const FileContainers &fileContainers)
|
||||
{
|
||||
Utf8String currentDocument;
|
||||
Utf8StringVector visibleDocuments;
|
||||
if (!m_postponeBackendJobs) {
|
||||
currentDocument = currentCppEditorDocumentFilePath();
|
||||
visibleDocuments = visibleCppEditorDocumentsFilePaths();
|
||||
}
|
||||
|
||||
const DocumentsOpenedMessage message(fileContainers, currentDocument, visibleDocuments);
|
||||
m_sender->documentsOpened(message);
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsChanged(const FileContainers &fileContainers)
|
||||
{
|
||||
const DocumentsChangedMessage message(fileContainers);
|
||||
m_sender->documentsChanged(message);
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsClosed(const FileContainers &fileContainers)
|
||||
{
|
||||
const DocumentsClosedMessage message(fileContainers);
|
||||
m_sender->documentsClosed(message);
|
||||
documentVisibilityChanged(); // QTCREATORBUG-25193
|
||||
}
|
||||
|
||||
void BackendCommunicator::unsavedFilesUpdated(const FileContainers &fileContainers)
|
||||
{
|
||||
const UnsavedFilesUpdatedMessage message(fileContainers);
|
||||
m_sender->unsavedFilesUpdated(message);
|
||||
}
|
||||
|
||||
void BackendCommunicator::unsavedFilesRemoved(const FileContainers &fileContainers)
|
||||
{
|
||||
const UnsavedFilesRemovedMessage message(fileContainers);
|
||||
m_sender->unsavedFilesRemoved(message);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangCodeModel
|
@@ -1,118 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "clangbackendreceiver.h"
|
||||
#include "clangbackendsender.h"
|
||||
|
||||
#include <cppeditor/projectpart.h>
|
||||
|
||||
#include <clangsupport/clangcodemodelconnectionclient.h>
|
||||
#include <clangsupport/filecontainer.h>
|
||||
|
||||
#include <QFuture>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QTimer>
|
||||
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
class IDocument;
|
||||
}
|
||||
|
||||
namespace TextEditor { class IAssistProcessor; }
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
class BackendCommunicator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using FileContainer = ClangBackEnd::FileContainer;
|
||||
using FileContainers = QVector<ClangBackEnd::FileContainer>;
|
||||
using LocalUseMap = CppEditor::SemanticInfo::LocalUseMap;
|
||||
|
||||
public:
|
||||
BackendCommunicator();
|
||||
~BackendCommunicator() override;
|
||||
|
||||
void documentsOpened(const FileContainers &fileContainers);
|
||||
void documentsChanged(Core::IDocument *document);
|
||||
void documentsChanged(const QString &filePath,
|
||||
const QByteArray &contents,
|
||||
uint documentRevision);
|
||||
void documentsChanged(const FileContainers &fileContainers);
|
||||
void documentsChangedFromCppEditorDocument(const QString &filePath);
|
||||
void documentsChangedIfNotCurrentDocument(Core::IDocument *document);
|
||||
void documentsChangedWithRevisionCheck(const ClangBackEnd::FileContainer &fileContainer);
|
||||
void documentsChangedWithRevisionCheck(Core::IDocument *document);
|
||||
void documentsClosed(const FileContainers &fileContainers);
|
||||
void documentVisibilityChanged();
|
||||
|
||||
void unsavedFilesUpdated(Core::IDocument *document);
|
||||
void unsavedFilesUpdated(const QString &filePath,
|
||||
const QByteArray &contents,
|
||||
uint documentRevision);
|
||||
void unsavedFilesUpdated(const FileContainers &fileContainers);
|
||||
void unsavedFilesUpdatedFromCppEditorDocument(const QString &filePath);
|
||||
void unsavedFilesRemoved(const FileContainers &fileContainers);
|
||||
|
||||
void updateChangeContentStartPosition(const QString &filePath, int position);
|
||||
|
||||
void setBackendJobsPostponed(bool postponed);
|
||||
|
||||
private:
|
||||
void initializeBackend();
|
||||
void initializeBackendWithCurrentData();
|
||||
void restoreCppEditorDocuments();
|
||||
void resetCppEditorDocumentProcessors();
|
||||
void unsavedFilesUpdatedForUiHeaders();
|
||||
|
||||
void setupDummySender();
|
||||
|
||||
void onConnectedToBackend();
|
||||
|
||||
void logExecutableDoesNotExist();
|
||||
void logRestartedDueToUnexpectedFinish();
|
||||
void logStartTimeOut();
|
||||
void logError(const QString &text);
|
||||
|
||||
void documentVisibilityChanged(const Utf8String ¤tEditorFilePath,
|
||||
const Utf8StringVector &visibleEditorsFilePaths);
|
||||
|
||||
private:
|
||||
BackendReceiver m_receiver;
|
||||
ClangBackEnd::ClangCodeModelConnectionClient m_connection;
|
||||
QTimer m_backendStartTimeOut;
|
||||
QScopedPointer<ClangBackEnd::ClangCodeModelServerInterface> m_sender;
|
||||
int m_connectedCount = 0;
|
||||
bool m_postponeBackendJobs = false;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangCodeModel
|
@@ -1,34 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: https://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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "clangbackendlogging.h"
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
Q_LOGGING_CATEGORY(ipcLog, "qtc.clangcodemodel.ipc", QtWarningMsg)
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangCodeModel
|
@@ -1,35 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: https://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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
namespace ClangCodeModel { namespace Internal {
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(ipcLog)
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangCodeModel
|
@@ -1,267 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: https://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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "clangbackendreceiver.h"
|
||||
|
||||
#include "clangbackendlogging.h"
|
||||
|
||||
#include "clangeditordocumentprocessor.h"
|
||||
|
||||
#include <clangsupport/clangcodemodelclientmessages.h>
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QTextBlock>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#define qCDebugIpc() qCDebug(ipcLog) << "<===="
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
static bool printAliveMessageHelper()
|
||||
{
|
||||
const bool print = qEnvironmentVariableIntValue("QTC_CLANG_FORCE_VERBOSE_ALIVE");
|
||||
if (!print) {
|
||||
qCDebug(ipcLog) << "Hint: AliveMessage will not be printed. "
|
||||
"Force it by setting QTC_CLANG_FORCE_VERBOSE_ALIVE=1.";
|
||||
}
|
||||
|
||||
return print;
|
||||
}
|
||||
|
||||
static bool printAliveMessage()
|
||||
{
|
||||
static bool print = ipcLog().isDebugEnabled() ? printAliveMessageHelper() : false;
|
||||
return print;
|
||||
}
|
||||
|
||||
BackendReceiver::BackendReceiver() = default;
|
||||
|
||||
BackendReceiver::~BackendReceiver()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void BackendReceiver::setAliveHandler(const BackendReceiver::AliveHandler &handler)
|
||||
{
|
||||
m_aliveHandler = handler;
|
||||
}
|
||||
|
||||
void BackendReceiver::reset()
|
||||
{
|
||||
// Clean up futures for references; TODO: Remove duplication
|
||||
for (ReferencesEntry &entry : m_referencesTable) {
|
||||
entry.futureInterface.cancel();
|
||||
entry.futureInterface.reportFinished();
|
||||
}
|
||||
m_referencesTable.clear();
|
||||
for (QFutureInterface<CppEditor::SymbolInfo> &futureInterface : m_followTable) {
|
||||
futureInterface.cancel();
|
||||
futureInterface.reportFinished();
|
||||
}
|
||||
m_followTable.clear();
|
||||
for (QFutureInterface<CppEditor::ToolTipInfo> &futureInterface : m_toolTipsTable) {
|
||||
futureInterface.cancel();
|
||||
futureInterface.reportFinished();
|
||||
}
|
||||
m_toolTipsTable.clear();
|
||||
}
|
||||
|
||||
void BackendReceiver::alive()
|
||||
{
|
||||
if (printAliveMessage())
|
||||
qCDebugIpc() << "AliveMessage";
|
||||
QTC_ASSERT(m_aliveHandler, return);
|
||||
m_aliveHandler();
|
||||
}
|
||||
|
||||
void BackendReceiver::echo(const ClangBackEnd::EchoMessage &message)
|
||||
{
|
||||
qCDebugIpc() << message;
|
||||
}
|
||||
|
||||
void BackendReceiver::completions(const ClangBackEnd::CompletionsMessage &message)
|
||||
{
|
||||
qCDebugIpc() << "CompletionsMessage with" << message.codeCompletions.size()
|
||||
<< "items";
|
||||
}
|
||||
|
||||
void BackendReceiver::annotations(const ClangBackEnd::AnnotationsMessage &message)
|
||||
{
|
||||
qCDebugIpc() << "AnnotationsMessage"
|
||||
<< "for" << QFileInfo(message.fileContainer.filePath).fileName() << "with"
|
||||
<< message.diagnostics.size() << "diagnostics" << message.tokenInfos.size()
|
||||
<< "token infos" << message.skippedPreprocessorRanges.size()
|
||||
<< "skipped preprocessor ranges";
|
||||
}
|
||||
|
||||
static
|
||||
CppEditor::CursorInfo::Range toCursorInfoRange(const ClangBackEnd::SourceRangeContainer &sourceRange)
|
||||
{
|
||||
const ClangBackEnd::SourceLocationContainer &start = sourceRange.start;
|
||||
const ClangBackEnd::SourceLocationContainer &end = sourceRange.end;
|
||||
const int length = end.column - start.column;
|
||||
|
||||
return {start.line, start.column, length};
|
||||
}
|
||||
|
||||
static
|
||||
CppEditor::CursorInfo toCursorInfo(const CppEditor::SemanticInfo::LocalUseMap &localUses,
|
||||
const ClangBackEnd::ReferencesMessage &message)
|
||||
{
|
||||
CppEditor::CursorInfo result;
|
||||
const QVector<ClangBackEnd::SourceRangeContainer> &references = message.references;
|
||||
|
||||
result.areUseRangesForLocalVariable = message.isLocalVariable;
|
||||
for (const ClangBackEnd::SourceRangeContainer &reference : references)
|
||||
result.useRanges.append(toCursorInfoRange(reference));
|
||||
|
||||
result.useRanges.reserve(references.size());
|
||||
result.localUses = localUses;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
CppEditor::SymbolInfo toSymbolInfo(const ClangBackEnd::FollowSymbolMessage &message)
|
||||
{
|
||||
CppEditor::SymbolInfo result;
|
||||
const ClangBackEnd::SourceRangeContainer &range = message.result.range;
|
||||
|
||||
const ClangBackEnd::SourceLocationContainer &start = range.start;
|
||||
const ClangBackEnd::SourceLocationContainer &end = range.end;
|
||||
result.startLine = start.line;
|
||||
result.startColumn = start.column;
|
||||
result.endLine = end.line;
|
||||
result.endColumn = end.column;
|
||||
result.fileName = start.filePath;
|
||||
|
||||
result.isResultOnlyForFallBack = message.result.isResultOnlyForFallBack;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void BackendReceiver::references(const ClangBackEnd::ReferencesMessage &message)
|
||||
{
|
||||
qCDebugIpc() << "ReferencesMessage with"
|
||||
<< message.references.size() << "references";
|
||||
|
||||
const quint64 ticket = message.ticketNumber;
|
||||
const ReferencesEntry entry = m_referencesTable.take(ticket);
|
||||
QFutureInterface<CppEditor::CursorInfo> futureInterface = entry.futureInterface;
|
||||
QTC_CHECK(futureInterface != QFutureInterface<CppEditor::CursorInfo>());
|
||||
|
||||
if (futureInterface.isCanceled())
|
||||
return; // Editor document closed or a new request was issued making this result outdated.
|
||||
|
||||
futureInterface.reportResult(toCursorInfo(entry.localUses, message));
|
||||
futureInterface.reportFinished();
|
||||
}
|
||||
|
||||
static Core::HelpItem::Category toHelpItemCategory(ClangBackEnd::ToolTipInfo::QdocCategory category)
|
||||
{
|
||||
switch (category) {
|
||||
case ClangBackEnd::ToolTipInfo::Unknown:
|
||||
return Core::HelpItem::Unknown;
|
||||
case ClangBackEnd::ToolTipInfo::ClassOrNamespace:
|
||||
return Core::HelpItem::ClassOrNamespace;
|
||||
case ClangBackEnd::ToolTipInfo::Enum:
|
||||
return Core::HelpItem::Enum;
|
||||
case ClangBackEnd::ToolTipInfo::Typedef:
|
||||
return Core::HelpItem::Typedef;
|
||||
case ClangBackEnd::ToolTipInfo::Macro:
|
||||
return Core::HelpItem::Macro;
|
||||
case ClangBackEnd::ToolTipInfo::Brief:
|
||||
return Core::HelpItem::Brief;
|
||||
case ClangBackEnd::ToolTipInfo::Function:
|
||||
return Core::HelpItem::Function;
|
||||
}
|
||||
|
||||
return Core::HelpItem::Unknown;
|
||||
}
|
||||
|
||||
static QStringList toStringList(const Utf8StringVector &utf8StringVector)
|
||||
{
|
||||
QStringList list;
|
||||
list.reserve(utf8StringVector.size());
|
||||
|
||||
for (const Utf8String &utf8String : utf8StringVector)
|
||||
list << utf8String.toString();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static CppEditor::ToolTipInfo toToolTipInfo(const ClangBackEnd::ToolTipMessage &message)
|
||||
{
|
||||
CppEditor::ToolTipInfo info;
|
||||
|
||||
const ClangBackEnd::ToolTipInfo &backendInfo = message.toolTipInfo;
|
||||
|
||||
info.text = backendInfo.text;
|
||||
info.briefComment = backendInfo.briefComment;
|
||||
|
||||
info.qDocIdCandidates = toStringList(backendInfo.qdocIdCandidates);
|
||||
info.qDocMark = backendInfo.qdocMark;
|
||||
info.qDocCategory = toHelpItemCategory(backendInfo.qdocCategory);
|
||||
info.value = backendInfo.value;
|
||||
info.sizeInBytes = backendInfo.sizeInBytes;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
void BackendReceiver::tooltip(const ClangBackEnd::ToolTipMessage &message)
|
||||
{
|
||||
qCDebugIpc() << "ToolTipMessage" << message.toolTipInfo.text;
|
||||
|
||||
const quint64 ticket = message.ticketNumber;
|
||||
QFutureInterface<CppEditor::ToolTipInfo> futureInterface = m_toolTipsTable.take(ticket);
|
||||
QTC_CHECK(futureInterface != QFutureInterface<CppEditor::ToolTipInfo>());
|
||||
|
||||
if (futureInterface.isCanceled())
|
||||
return; // A new request was issued making this one outdated.
|
||||
|
||||
futureInterface.reportResult(toToolTipInfo(message));
|
||||
futureInterface.reportFinished();
|
||||
}
|
||||
|
||||
void BackendReceiver::followSymbol(const ClangBackEnd::FollowSymbolMessage &message)
|
||||
{
|
||||
qCDebugIpc() << "FollowSymbolMessage with"
|
||||
<< message.result;
|
||||
|
||||
const quint64 ticket = message.ticketNumber;
|
||||
QFutureInterface<CppEditor::SymbolInfo> futureInterface = m_followTable.take(ticket);
|
||||
QTC_CHECK(futureInterface != QFutureInterface<CppEditor::SymbolInfo>());
|
||||
|
||||
if (futureInterface.isCanceled())
|
||||
return; // Editor document closed or a new request was issued making this result outdated.
|
||||
|
||||
futureInterface.reportResult(toSymbolInfo(message));
|
||||
futureInterface.reportFinished();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangCodeModel
|
@@ -1,85 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: https://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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cppeditor/cppcursorinfo.h>
|
||||
#include <cppeditor/cpptoolsreuse.h>
|
||||
#include <cppeditor/baseeditordocumentprocessor.h>
|
||||
|
||||
#include <clangsupport/clangcodemodelclientinterface.h>
|
||||
|
||||
#include <QFuture>
|
||||
#include <QPointer>
|
||||
#include <QTextDocument>
|
||||
|
||||
namespace TextEditor {
|
||||
class IAssistProcessor;
|
||||
class TextEditorWidget;
|
||||
} // namespace TextEditor
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
class BackendReceiver : public ClangBackEnd::ClangCodeModelClientInterface
|
||||
{
|
||||
public:
|
||||
BackendReceiver();
|
||||
~BackendReceiver() override;
|
||||
|
||||
using AliveHandler = std::function<void ()>;
|
||||
void setAliveHandler(const AliveHandler &handler);
|
||||
|
||||
void reset();
|
||||
|
||||
private:
|
||||
void alive() override;
|
||||
void echo(const ClangBackEnd::EchoMessage &message) override;
|
||||
void completions(const ClangBackEnd::CompletionsMessage &message) override;
|
||||
|
||||
void annotations(const ClangBackEnd::AnnotationsMessage &message) override;
|
||||
void references(const ClangBackEnd::ReferencesMessage &message) override;
|
||||
void tooltip(const ClangBackEnd::ToolTipMessage &message) override;
|
||||
void followSymbol(const ClangBackEnd::FollowSymbolMessage &message) override;
|
||||
|
||||
private:
|
||||
AliveHandler m_aliveHandler;
|
||||
|
||||
struct ReferencesEntry {
|
||||
ReferencesEntry() = default;
|
||||
ReferencesEntry(QFutureInterface<CppEditor::CursorInfo> futureInterface,
|
||||
const CppEditor::SemanticInfo::LocalUseMap &localUses)
|
||||
: futureInterface(futureInterface)
|
||||
, localUses(localUses) {}
|
||||
QFutureInterface<CppEditor::CursorInfo> futureInterface;
|
||||
CppEditor::SemanticInfo::LocalUseMap localUses;
|
||||
};
|
||||
QHash<quint64, ReferencesEntry> m_referencesTable;
|
||||
QHash<quint64, QFutureInterface<CppEditor::ToolTipInfo>> m_toolTipsTable;
|
||||
QHash<quint64, QFutureInterface<CppEditor::SymbolInfo>> m_followTable;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangCodeModel
|
@@ -1,131 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: https://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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "clangbackendsender.h"
|
||||
|
||||
#include "clangbackendlogging.h"
|
||||
|
||||
#include <clangsupport/clangcodemodelconnectionclient.h>
|
||||
#include <clangsupport/clangcodemodelservermessages.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#define qCDebugIpc() qCDebug(ipcLog) << "====>"
|
||||
|
||||
using namespace ClangBackEnd;
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
BackendSender::BackendSender(ClangCodeModelConnectionClient *connectionClient)
|
||||
: m_connection(connectionClient)
|
||||
{}
|
||||
|
||||
void BackendSender::end()
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << ClangBackEnd::EndMessage();
|
||||
m_connection->sendEndMessage();
|
||||
}
|
||||
|
||||
void BackendSender::documentsOpened(const DocumentsOpenedMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().documentsOpened(message);
|
||||
}
|
||||
|
||||
void BackendSender::documentsChanged(const DocumentsChangedMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().documentsChanged(message);
|
||||
}
|
||||
|
||||
void BackendSender::documentsClosed(const DocumentsClosedMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().documentsClosed(message);
|
||||
}
|
||||
|
||||
void BackendSender::unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().unsavedFilesUpdated(message);
|
||||
}
|
||||
|
||||
void BackendSender::unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().unsavedFilesRemoved(message);
|
||||
}
|
||||
|
||||
void BackendSender::requestCompletions(const RequestCompletionsMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().requestCompletions(message);
|
||||
}
|
||||
|
||||
void BackendSender::requestAnnotations(const RequestAnnotationsMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().requestAnnotations(message);
|
||||
}
|
||||
|
||||
void BackendSender::requestReferences(const RequestReferencesMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().requestReferences(message);
|
||||
}
|
||||
|
||||
void BackendSender::requestToolTip(const RequestToolTipMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebug(ipcLog) << ">>>" << message;
|
||||
m_connection->serverProxy().requestToolTip(message);
|
||||
}
|
||||
|
||||
void BackendSender::requestFollowSymbol(const RequestFollowSymbolMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().requestFollowSymbol(message);
|
||||
}
|
||||
|
||||
void BackendSender::documentVisibilityChanged(const DocumentVisibilityChangedMessage &message)
|
||||
{
|
||||
QTC_CHECK(m_connection->isConnected());
|
||||
qCDebugIpc() << message;
|
||||
m_connection->serverProxy().documentVisibilityChanged(message);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangCodeModel
|
@@ -1,61 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: https://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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <clangsupport/clangcodemodelserverinterface.h>
|
||||
|
||||
namespace ClangBackEnd { class ClangCodeModelConnectionClient; }
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
class BackendSender : public ClangBackEnd::ClangCodeModelServerInterface
|
||||
{
|
||||
public:
|
||||
BackendSender(ClangBackEnd::ClangCodeModelConnectionClient *connectionClient);
|
||||
|
||||
void end() override;
|
||||
|
||||
void documentsOpened(const ClangBackEnd::DocumentsOpenedMessage &message) override;
|
||||
void documentsChanged(const ClangBackEnd::DocumentsChangedMessage &message) override;
|
||||
void documentsClosed(const ClangBackEnd::DocumentsClosedMessage &message) override;
|
||||
void documentVisibilityChanged(const ClangBackEnd::DocumentVisibilityChangedMessage &message) override;
|
||||
|
||||
void unsavedFilesUpdated(const ClangBackEnd::UnsavedFilesUpdatedMessage &message) override;
|
||||
void unsavedFilesRemoved(const ClangBackEnd::UnsavedFilesRemovedMessage &message) override;
|
||||
|
||||
void requestCompletions(const ClangBackEnd::RequestCompletionsMessage &message) override;
|
||||
void requestAnnotations(const ClangBackEnd::RequestAnnotationsMessage &message) override;
|
||||
void requestReferences(const ClangBackEnd::RequestReferencesMessage &message) override;
|
||||
void requestToolTip(const ClangBackEnd::RequestToolTipMessage &message) override;
|
||||
void requestFollowSymbol(const ClangBackEnd::RequestFollowSymbolMessage &message) override;
|
||||
|
||||
private:
|
||||
ClangBackEnd::ClangCodeModelConnectionClient *m_connection = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangCodeModel
|
@@ -29,14 +29,6 @@ QtcPlugin {
|
||||
"clangactivationsequencecontextprocessor.h",
|
||||
"clangactivationsequenceprocessor.cpp",
|
||||
"clangactivationsequenceprocessor.h",
|
||||
"clangbackendcommunicator.cpp",
|
||||
"clangbackendcommunicator.h",
|
||||
"clangbackendlogging.cpp",
|
||||
"clangbackendlogging.h",
|
||||
"clangbackendreceiver.cpp",
|
||||
"clangbackendreceiver.h",
|
||||
"clangbackendsender.cpp",
|
||||
"clangbackendsender.h",
|
||||
"clangcodemodelplugin.cpp",
|
||||
"clangcodemodelplugin.h",
|
||||
"clangcompletioncontextanalyzer.cpp",
|
||||
|
Reference in New Issue
Block a user