forked from qt-creator/qt-creator
Clang: Pass IpcCommunicator directly to ClangEditorDocumentProcessor
Change-Id: I666c56f304522a3edc2a21055df4ef70aecb0e0e Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -30,10 +30,10 @@
|
|||||||
|
|
||||||
#include "clangeditordocumentprocessor.h"
|
#include "clangeditordocumentprocessor.h"
|
||||||
|
|
||||||
|
#include "clangbackendipcintegration.h"
|
||||||
#include "clangfixitoperation.h"
|
#include "clangfixitoperation.h"
|
||||||
#include "clangfixitoperationsextractor.h"
|
#include "clangfixitoperationsextractor.h"
|
||||||
#include "clanghighlightingmarksreporter.h"
|
#include "clanghighlightingmarksreporter.h"
|
||||||
#include "clangmodelmanagersupport.h"
|
|
||||||
#include "clangutils.h"
|
#include "clangutils.h"
|
||||||
|
|
||||||
#include <diagnosticcontainer.h>
|
#include <diagnosticcontainer.h>
|
||||||
@@ -62,11 +62,11 @@ namespace ClangCodeModel {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(
|
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(
|
||||||
ModelManagerSupportClang *modelManagerSupport,
|
IpcCommunicator &ipcCommunicator,
|
||||||
TextEditor::TextDocument *document)
|
TextEditor::TextDocument *document)
|
||||||
: BaseEditorDocumentProcessor(document)
|
: BaseEditorDocumentProcessor(document)
|
||||||
, m_diagnosticManager(document)
|
, m_diagnosticManager(document)
|
||||||
, m_modelManagerSupport(modelManagerSupport)
|
, m_ipcCommunicator(ipcCommunicator)
|
||||||
, m_parser(new ClangEditorDocumentParser(document->filePath().toString()))
|
, m_parser(new ClangEditorDocumentParser(document->filePath().toString()))
|
||||||
, m_parserRevision(0)
|
, m_parserRevision(0)
|
||||||
, m_semanticHighlighter(document)
|
, m_semanticHighlighter(document)
|
||||||
@@ -86,8 +86,7 @@ ClangEditorDocumentProcessor::~ClangEditorDocumentProcessor()
|
|||||||
m_parserWatcher.waitForFinished();
|
m_parserWatcher.waitForFinished();
|
||||||
|
|
||||||
if (m_projectPart) {
|
if (m_projectPart) {
|
||||||
QTC_ASSERT(m_modelManagerSupport, return);
|
m_ipcCommunicator.unregisterTranslationUnitsForEditor(
|
||||||
m_modelManagerSupport->ipcCommunicator().unregisterTranslationUnitsForEditor(
|
|
||||||
{ClangBackEnd::FileContainer(filePath(), m_projectPart->id())});
|
{ClangBackEnd::FileContainer(filePath(), m_projectPart->id())});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,16 +280,13 @@ void ClangEditorDocumentProcessor::onParserFinished()
|
|||||||
|
|
||||||
void ClangEditorDocumentProcessor::registerTranslationUnitForEditor(CppTools::ProjectPart *projectPart)
|
void ClangEditorDocumentProcessor::registerTranslationUnitForEditor(CppTools::ProjectPart *projectPart)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_modelManagerSupport, return);
|
|
||||||
IpcCommunicator &ipcCommunicator = m_modelManagerSupport->ipcCommunicator();
|
|
||||||
|
|
||||||
if (m_projectPart) {
|
if (m_projectPart) {
|
||||||
if (projectPart->id() != m_projectPart->id()) {
|
if (projectPart->id() != m_projectPart->id()) {
|
||||||
ipcCommunicator.unregisterTranslationUnitsForEditor({fileContainerWithArguments()});
|
m_ipcCommunicator.unregisterTranslationUnitsForEditor({fileContainerWithArguments()});
|
||||||
ipcCommunicator.registerTranslationUnitsForEditor({fileContainerWithArguments(projectPart)});
|
m_ipcCommunicator.registerTranslationUnitsForEditor({fileContainerWithArguments(projectPart)});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ipcCommunicator.registerTranslationUnitsForEditor({{fileContainerWithArguments(projectPart)}});
|
m_ipcCommunicator.registerTranslationUnitsForEditor({{fileContainerWithArguments(projectPart)}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +295,7 @@ void ClangEditorDocumentProcessor::updateTranslationUnitIfProjectPartExists()
|
|||||||
if (m_projectPart) {
|
if (m_projectPart) {
|
||||||
const ClangBackEnd::FileContainer fileContainer = fileContainerWithDocumentContent(m_projectPart->id());
|
const ClangBackEnd::FileContainer fileContainer = fileContainerWithDocumentContent(m_projectPart->id());
|
||||||
|
|
||||||
m_modelManagerSupport->ipcCommunicator().updateTranslationUnitWithRevisionCheck(fileContainer);
|
m_ipcCommunicator.updateTranslationUnitWithRevisionCheck(fileContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,9 +303,8 @@ void ClangEditorDocumentProcessor::requestDocumentAnnotations(const QString &pro
|
|||||||
{
|
{
|
||||||
const auto fileContainer = fileContainerWithDocumentContent(projectpartId);
|
const auto fileContainer = fileContainerWithDocumentContent(projectpartId);
|
||||||
|
|
||||||
auto &ipcCommunicator = m_modelManagerSupport->ipcCommunicator();
|
m_ipcCommunicator.requestDiagnostics(fileContainer);
|
||||||
ipcCommunicator.requestDiagnostics(fileContainer);
|
m_ipcCommunicator.requestHighlighting(fileContainer);
|
||||||
ipcCommunicator.requestHighlighting(fileContainer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static CppTools::ProjectPart projectPartForLanguageOption(CppTools::ProjectPart *projectPart)
|
static CppTools::ProjectPart projectPartForLanguageOption(CppTools::ProjectPart *projectPart)
|
||||||
|
|||||||
@@ -34,12 +34,10 @@
|
|||||||
#include "clangdiagnosticmanager.h"
|
#include "clangdiagnosticmanager.h"
|
||||||
#include "clangeditordocumentparser.h"
|
#include "clangeditordocumentparser.h"
|
||||||
|
|
||||||
#include <cpptools/baseeditordocumentprocessor.h>
|
|
||||||
#include <cpptools/builtineditordocumentprocessor.h>
|
#include <cpptools/builtineditordocumentprocessor.h>
|
||||||
#include <cpptools/semantichighlighter.h>
|
#include <cpptools/semantichighlighter.h>
|
||||||
|
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
class DiagnosticContainer;
|
class DiagnosticContainer;
|
||||||
@@ -50,14 +48,14 @@ class FileContainer;
|
|||||||
namespace ClangCodeModel {
|
namespace ClangCodeModel {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ModelManagerSupportClang;
|
class IpcCommunicator;
|
||||||
|
|
||||||
class ClangEditorDocumentProcessor : public CppTools::BaseEditorDocumentProcessor
|
class ClangEditorDocumentProcessor : public CppTools::BaseEditorDocumentProcessor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClangEditorDocumentProcessor(ModelManagerSupportClang *modelManagerSupport,
|
ClangEditorDocumentProcessor(IpcCommunicator &ipcCommunicator,
|
||||||
TextEditor::TextDocument *document);
|
TextEditor::TextDocument *document);
|
||||||
~ClangEditorDocumentProcessor();
|
~ClangEditorDocumentProcessor();
|
||||||
|
|
||||||
@@ -103,7 +101,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ClangDiagnosticManager m_diagnosticManager;
|
ClangDiagnosticManager m_diagnosticManager;
|
||||||
QPointer<ModelManagerSupportClang> m_modelManagerSupport;
|
IpcCommunicator &m_ipcCommunicator;
|
||||||
QSharedPointer<ClangEditorDocumentParser> m_parser;
|
QSharedPointer<ClangEditorDocumentParser> m_parser;
|
||||||
CppTools::ProjectPart::Ptr m_projectPart;
|
CppTools::ProjectPart::Ptr m_projectPart;
|
||||||
QFutureWatcher<void> m_parserWatcher;
|
QFutureWatcher<void> m_parserWatcher;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ CppTools::CppCompletionAssistProvider *ModelManagerSupportClang::completionAssis
|
|||||||
CppTools::BaseEditorDocumentProcessor *ModelManagerSupportClang::editorDocumentProcessor(
|
CppTools::BaseEditorDocumentProcessor *ModelManagerSupportClang::editorDocumentProcessor(
|
||||||
TextEditor::TextDocument *baseTextDocument)
|
TextEditor::TextDocument *baseTextDocument)
|
||||||
{
|
{
|
||||||
return new ClangEditorDocumentProcessor(this, baseTextDocument);
|
return new ClangEditorDocumentProcessor(m_ipcCommunicator, baseTextDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelManagerSupportClang::onCurrentEditorChanged(Core::IEditor *)
|
void ModelManagerSupportClang::onCurrentEditorChanged(Core::IEditor *)
|
||||||
|
|||||||
Reference in New Issue
Block a user