forked from qt-creator/qt-creator
Clang: Remove project part dependency in IpcCommunicator
Change-Id: I312f4a3721c045ae4b4ed4b72218201dbb38aa4b Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
#include <cpptools/abstracteditorsupport.h>
|
#include <cpptools/abstracteditorsupport.h>
|
||||||
#include <cpptools/baseeditordocumentprocessor.h>
|
#include <cpptools/baseeditordocumentprocessor.h>
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
|
#include <cpptools/cpptoolsbridge.h>
|
||||||
#include <cpptools/editordocumenthandle.h>
|
#include <cpptools/editordocumenthandle.h>
|
||||||
#include <cpptools/projectinfo.h>
|
#include <cpptools/projectinfo.h>
|
||||||
|
|
||||||
@@ -172,9 +173,10 @@ void IpcReceiver::diagnosticsChanged(const DiagnosticsChangedMessage &message)
|
|||||||
|
|
||||||
auto processor = ClangEditorDocumentProcessor::get(message.file().filePath());
|
auto processor = ClangEditorDocumentProcessor::get(message.file().filePath());
|
||||||
|
|
||||||
if (processor && processor->projectPart()) {
|
if (processor) {
|
||||||
const QString diagnosticsProjectPartId = message.file().projectPartId();
|
const QString diagnosticsProjectPartId = message.file().projectPartId();
|
||||||
const QString documentProjectPartId = processor->projectPart()->id();
|
const QString filePath = message.file().filePath();
|
||||||
|
const QString documentProjectPartId = CppTools::CppToolsBridge::projectPartIdForFile(filePath);
|
||||||
if (diagnosticsProjectPartId == documentProjectPartId)
|
if (diagnosticsProjectPartId == documentProjectPartId)
|
||||||
processor->updateCodeWarnings(message.diagnostics(), message.file().documentRevision());
|
processor->updateCodeWarnings(message.diagnostics(), message.file().documentRevision());
|
||||||
}
|
}
|
||||||
@@ -187,9 +189,10 @@ void IpcReceiver::highlightingChanged(const HighlightingChangedMessage &message)
|
|||||||
|
|
||||||
auto processor = ClangEditorDocumentProcessor::get(message.file().filePath());
|
auto processor = ClangEditorDocumentProcessor::get(message.file().filePath());
|
||||||
|
|
||||||
if (processor && processor->projectPart()) {
|
if (processor) {
|
||||||
const QString highlightingProjectPartId = message.file().projectPartId();
|
const QString highlightingProjectPartId = message.file().projectPartId();
|
||||||
const QString documentProjectPartId = processor->projectPart()->id();
|
const QString filePath = message.file().filePath();
|
||||||
|
const QString documentProjectPartId = CppTools::CppToolsBridge::projectPartIdForFile(filePath);
|
||||||
if (highlightingProjectPartId == documentProjectPartId) {
|
if (highlightingProjectPartId == documentProjectPartId) {
|
||||||
processor->updateHighlighting(message.highlightingMarks(),
|
processor->updateHighlighting(message.highlightingMarks(),
|
||||||
message.skippedPreprocessorRanges(),
|
message.skippedPreprocessorRanges(),
|
||||||
@@ -422,7 +425,7 @@ void removeNonCppEditors(QList<Core::IEditor*> &visibleEditors)
|
|||||||
|
|
||||||
Utf8StringVector visibleCppEditorDocumentsFilePaths()
|
Utf8StringVector visibleCppEditorDocumentsFilePaths()
|
||||||
{
|
{
|
||||||
auto visibleEditors = Core::EditorManager::visibleEditors();
|
auto visibleEditors = CppTools::CppToolsBridge::visibleEditors();
|
||||||
|
|
||||||
removeNonCppEditors(visibleEditors);
|
removeNonCppEditors(visibleEditors);
|
||||||
|
|
||||||
@@ -606,7 +609,7 @@ void IpcCommunicator::updateTranslationUnitWithRevisionCheck(Core::IDocument *do
|
|||||||
{
|
{
|
||||||
const auto textDocument = qobject_cast<TextDocument*>(document);
|
const auto textDocument = qobject_cast<TextDocument*>(document);
|
||||||
const auto filePath = textDocument->filePath().toString();
|
const auto filePath = textDocument->filePath().toString();
|
||||||
const QString projectPartId = Utils::projectPartIdForFile(filePath);
|
const QString projectPartId = CppTools::CppToolsBridge::projectPartIdForFile(filePath);
|
||||||
|
|
||||||
updateTranslationUnitWithRevisionCheck(FileContainer(filePath,
|
updateTranslationUnitWithRevisionCheck(FileContainer(filePath,
|
||||||
projectPartId,
|
projectPartId,
|
||||||
|
|||||||
Reference in New Issue
Block a user