diff --git a/src/tools/clangbackend/ipcsource/clangipcserver.cpp b/src/tools/clangbackend/ipcsource/clangipcserver.cpp index eeae3d7ffb5..311169ac6e0 100644 --- a/src/tools/clangbackend/ipcsource/clangipcserver.cpp +++ b/src/tools/clangbackend/ipcsource/clangipcserver.cpp @@ -66,40 +66,40 @@ namespace ClangBackEnd { namespace { -const int delayedEditorUpdatesTimerInterval = 300; +const int delayedDocumentAnnotationsTimerInterval = 300; } ClangIpcServer::ClangIpcServer() : translationUnits(projects, unsavedFiles) { - const auto sendEditorUpdates + const auto sendDocumentAnnotations = [this] (const DiagnosticsChangedMessage &diagnosticsMessage, const HighlightingChangedMessage &highlightingsMessage) { client()->diagnosticsChanged(diagnosticsMessage); client()->highlightingChanged(highlightingsMessage); }; - const auto sendDelayedEditorUpdates = [this] () { + const auto sendDelayedDocumentAnnotations = [this] () { try { - auto editorUpdatesSendState = translationUnits.sendDelayedEditorUpdates(); - if (editorUpdatesSendState == EditorUpdatesSendState::MaybeThereAreMoreEditorUpdates) - sendDelayedEditorUpdatesTimer.setInterval(0); + auto sendState = translationUnits.sendDocumentAnnotations(); + if (sendState == DocumentAnnotationsSendState::MaybeThereAreDocumentAnnotations) + sendDocumentAnnotationsTimer.setInterval(0); else - sendDelayedEditorUpdatesTimer.stop(); + sendDocumentAnnotationsTimer.stop(); } catch (const std::exception &exception) { - qWarning() << "Error in ClangIpcServer::sendDelayedEditorUpdatesTimer:" << exception.what(); + qWarning() << "Error in ClangIpcServer::sendDelayedDocumentAnnotationsTimer:" << exception.what(); } }; const auto onFileChanged = [this] (const Utf8String &filePath) { - startSendDelayedEditorUpdatesTimerIfFileIsNotATranslationUnit(filePath); + startDocumentAnnotationsTimerIfFileIsNotATranslationUnit(filePath); }; - translationUnits.setSendDelayedEditorUpdatesCallback(sendEditorUpdates); + translationUnits.setSendDocumentAnnotationsCallback(sendDocumentAnnotations); - QObject::connect(&sendDelayedEditorUpdatesTimer, + QObject::connect(&sendDocumentAnnotationsTimer, &QTimer::timeout, - sendDelayedEditorUpdates); + sendDelayedDocumentAnnotations); QObject::connect(translationUnits.clangFileSystemWatcher(), &ClangFileSystemWatcher::fileChanged, @@ -118,7 +118,7 @@ void ClangIpcServer::registerTranslationUnitsForEditor(const ClangBackEnd::Regis try { translationUnits.create(message.fileContainers()); unsavedFiles.createOrUpdate(message.fileContainers()); - sendDelayedEditorUpdatesTimer.start(0); + sendDocumentAnnotationsTimer.start(0); } catch (const ProjectPartDoNotExistException &exception) { client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds())); } catch (const std::exception &exception) { @@ -135,7 +135,7 @@ void ClangIpcServer::updateTranslationUnitsForEditor(const UpdateTranslationUnit if (newerFileContainers.size() > 0) { translationUnits.update(newerFileContainers); unsavedFiles.createOrUpdate(newerFileContainers); - sendDelayedEditorUpdatesTimer.start(delayedEditorUpdatesTimerInterval); + sendDocumentAnnotationsTimer.start(delayedDocumentAnnotationsTimerInterval); } } catch (const ProjectPartDoNotExistException &exception) { client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds())); @@ -193,7 +193,7 @@ void ClangIpcServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesFor try { unsavedFiles.createOrUpdate(message.fileContainers()); translationUnits.updateTranslationUnitsWithChangedDependencies(message.fileContainers()); - sendDelayedEditorUpdatesTimer.start(delayedEditorUpdatesTimerInterval); + sendDocumentAnnotationsTimer.start(delayedDocumentAnnotationsTimerInterval); } catch (const ProjectPartDoNotExistException &exception) { client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds())); } catch (const std::exception &exception) { @@ -292,10 +292,10 @@ const TranslationUnits &ClangIpcServer::translationUnitsForTestOnly() const return translationUnits; } -void ClangIpcServer::startSendDelayedEditorUpdatesTimerIfFileIsNotATranslationUnit(const Utf8String &filePath) +void ClangIpcServer::startDocumentAnnotationsTimerIfFileIsNotATranslationUnit(const Utf8String &filePath) { if (!translationUnits.hasTranslationUnit(filePath)) - sendDelayedEditorUpdatesTimer.start(0); + sendDocumentAnnotationsTimer.start(0); } } diff --git a/src/tools/clangbackend/ipcsource/clangipcserver.h b/src/tools/clangbackend/ipcsource/clangipcserver.h index 5ca9553c85b..f5f768552d9 100644 --- a/src/tools/clangbackend/ipcsource/clangipcserver.h +++ b/src/tools/clangbackend/ipcsource/clangipcserver.h @@ -67,13 +67,13 @@ public: const TranslationUnits &translationUnitsForTestOnly() const; private: - void startSendDelayedEditorUpdatesTimerIfFileIsNotATranslationUnit(const Utf8String &filePath); + void startDocumentAnnotationsTimerIfFileIsNotATranslationUnit(const Utf8String &filePath); private: ProjectParts projects; UnsavedFiles unsavedFiles; TranslationUnits translationUnits; - QTimer sendDelayedEditorUpdatesTimer; + QTimer sendDocumentAnnotationsTimer; }; } // namespace ClangBackEnd diff --git a/src/tools/clangbackend/ipcsource/translationunits.cpp b/src/tools/clangbackend/ipcsource/translationunits.cpp index 459679fc7a2..afdcd15246c 100644 --- a/src/tools/clangbackend/ipcsource/translationunits.cpp +++ b/src/tools/clangbackend/ipcsource/translationunits.cpp @@ -166,73 +166,73 @@ void TranslationUnits::updateTranslationUnitsWithChangedDependencies(const QVect updateTranslationUnitsWithChangedDependency(fileContainer.filePath()); } -EditorUpdatesSendState TranslationUnits::sendDelayedEditorUpdates() +DocumentAnnotationsSendState TranslationUnits::sendDocumentAnnotations() { - auto editorUpdatesSendState = sendDelayedEditorUpdatesForCurrentEditor(); - if (editorUpdatesSendState == EditorUpdatesSendState::NoEditorUpdatesSend) - editorUpdatesSendState = sendDelayedEditorUpdatesForVisibleEditors(); - if (editorUpdatesSendState == EditorUpdatesSendState::NoEditorUpdatesSend) - editorUpdatesSendState = sendDelayedEditorUpdatesForAll(); + auto documentAnnotationsSendState = sendDocumentAnnotationsForCurrentEditor(); + if (documentAnnotationsSendState == DocumentAnnotationsSendState::NoDocumentAnnotationsSent) + documentAnnotationsSendState = sendDocumentAnnotationsForVisibleEditors(); + if (documentAnnotationsSendState == DocumentAnnotationsSendState::NoDocumentAnnotationsSent) + documentAnnotationsSendState = sendDocumentAnnotationsForAll(); - return editorUpdatesSendState; + return documentAnnotationsSendState; } template -EditorUpdatesSendState TranslationUnits::sendDelayedEditorUpdates(Predicate predicate) +DocumentAnnotationsSendState TranslationUnits::sendDocumentAnnotations(Predicate predicate) { auto foundTranslationUnit = std::find_if(translationUnits_.begin(), translationUnits_.end(), predicate); if (foundTranslationUnit != translationUnits().end()) { - sendDelayedEditorUpdates(*foundTranslationUnit); - return EditorUpdatesSendState::MaybeThereAreMoreEditorUpdates; + sendDocumentAnnotations(*foundTranslationUnit); + return DocumentAnnotationsSendState::MaybeThereAreDocumentAnnotations; } - return EditorUpdatesSendState::NoEditorUpdatesSend; + return DocumentAnnotationsSendState::NoDocumentAnnotationsSent; } namespace { -bool translationUnitHasEditorDocumentUpdates(const TranslationUnit &translationUnit) +bool translationUnitHasNewDocumentAnnotations(const TranslationUnit &translationUnit) { return translationUnit.hasNewDiagnostics() || translationUnit.hasNewHighlightingInformations(); } } -EditorUpdatesSendState TranslationUnits::sendDelayedEditorUpdatesForCurrentEditor() +DocumentAnnotationsSendState TranslationUnits::sendDocumentAnnotationsForCurrentEditor() { - auto hasEditorUpdatesForCurrentEditor = [] (const TranslationUnit &translationUnit) { + auto hasDocumentAnnotationsForCurrentEditor = [] (const TranslationUnit &translationUnit) { return translationUnit.isUsedByCurrentEditor() - && translationUnitHasEditorDocumentUpdates(translationUnit); + && translationUnitHasNewDocumentAnnotations(translationUnit); }; - return sendDelayedEditorUpdates(hasEditorUpdatesForCurrentEditor); + return sendDocumentAnnotations(hasDocumentAnnotationsForCurrentEditor); } -EditorUpdatesSendState TranslationUnits::sendDelayedEditorUpdatesForVisibleEditors() +DocumentAnnotationsSendState TranslationUnits::sendDocumentAnnotationsForVisibleEditors() { - auto hasEditorUpdatesForVisibleEditor = [] (const TranslationUnit &translationUnit) { + auto hasDocumentAnnotationsForVisibleEditor = [] (const TranslationUnit &translationUnit) { return translationUnit.isVisibleInEditor() - && translationUnitHasEditorDocumentUpdates(translationUnit); + && translationUnitHasNewDocumentAnnotations(translationUnit); }; - return sendDelayedEditorUpdates(hasEditorUpdatesForVisibleEditor); + return sendDocumentAnnotations(hasDocumentAnnotationsForVisibleEditor); } -EditorUpdatesSendState TranslationUnits::sendDelayedEditorUpdatesForAll() +DocumentAnnotationsSendState TranslationUnits::sendDocumentAnnotationsForAll() { - auto hasEditorUpdates = [] (const TranslationUnit &translationUnit) { - return translationUnitHasEditorDocumentUpdates(translationUnit); + auto hasDocumentAnnotations = [] (const TranslationUnit &translationUnit) { + return translationUnitHasNewDocumentAnnotations(translationUnit); }; - return sendDelayedEditorUpdates(hasEditorUpdates); + return sendDocumentAnnotations(hasDocumentAnnotations); } -void TranslationUnits::setSendDelayedEditorUpdatesCallback(DelayedEditorUpdatesCallback &&callback) +void TranslationUnits::setSendDocumentAnnotationsCallback(SendDocumentAnnotationsCallback &&callback) { - sendDelayedEditorUpdatesCallback = std::move(callback); + sendDocumentAnnotationsCallback = std::move(callback); } QVector TranslationUnits::newerFileContainers(const QVector &fileContainers) const @@ -354,9 +354,9 @@ void TranslationUnits::checkIfTranslationUnitsForFilePathsDoesExists(const QVect } } -void TranslationUnits::sendDelayedEditorUpdates(const TranslationUnit &translationUnit) +void TranslationUnits::sendDocumentAnnotations(const TranslationUnit &translationUnit) { - if (sendDelayedEditorUpdatesCallback) { + if (sendDocumentAnnotationsCallback) { const auto fileContainer = translationUnit.fileContainer(); DiagnosticsChangedMessage diagnosticsMessage(fileContainer, translationUnit.mainFileDiagnostics()); @@ -364,8 +364,8 @@ void TranslationUnits::sendDelayedEditorUpdates(const TranslationUnit &translati translationUnit.highlightingInformations().toHighlightingMarksContainers(), translationUnit.skippedSourceRanges().toSourceRangeContainers()); - sendDelayedEditorUpdatesCallback(std::move(diagnosticsMessage), - std::move(highlightingsMessage)); + sendDocumentAnnotationsCallback(std::move(diagnosticsMessage), + std::move(highlightingsMessage)); } } diff --git a/src/tools/clangbackend/ipcsource/translationunits.h b/src/tools/clangbackend/ipcsource/translationunits.h index aca120dad00..90df960a29b 100644 --- a/src/tools/clangbackend/ipcsource/translationunits.h +++ b/src/tools/clangbackend/ipcsource/translationunits.h @@ -48,17 +48,18 @@ class UnsavedFiles; class DiagnosticsChangedMessage; class HighlightingChangedMessage; -enum class EditorUpdatesSendState +enum class DocumentAnnotationsSendState { - NoEditorUpdatesSend, - MaybeThereAreMoreEditorUpdates, + NoDocumentAnnotationsSent, + MaybeThereAreDocumentAnnotations, }; class TranslationUnits { public: - using DelayedEditorUpdatesCallback = std::function; + using SendDocumentAnnotationsCallback + = std::function; public: TranslationUnits(ProjectParts &projectParts, UnsavedFiles &unsavedFiles); @@ -83,13 +84,12 @@ public: void updateTranslationUnitsWithChangedDependency(const Utf8String &filePath); void updateTranslationUnitsWithChangedDependencies(const QVector &fileContainers); - EditorUpdatesSendState sendDelayedEditorUpdatesForCurrentEditor(); - EditorUpdatesSendState sendDelayedEditorUpdatesForVisibleEditors(); - EditorUpdatesSendState sendDelayedEditorUpdatesForAll(); + DocumentAnnotationsSendState sendDocumentAnnotationsForCurrentEditor(); + DocumentAnnotationsSendState sendDocumentAnnotationsForVisibleEditors(); + DocumentAnnotationsSendState sendDocumentAnnotationsForAll(); + DocumentAnnotationsSendState sendDocumentAnnotations(); - EditorUpdatesSendState sendDelayedEditorUpdates(); - - void setSendDelayedEditorUpdatesCallback(DelayedEditorUpdatesCallback &&callback); + void setSendDocumentAnnotationsCallback(SendDocumentAnnotationsCallback &&callback); QVector newerFileContainers(const QVector &fileContainers) const; @@ -108,15 +108,15 @@ private: void checkIfTranslationUnitsDoesNotExists(const QVector &fileContainers) const; void checkIfTranslationUnitsForFilePathsDoesExists(const QVector &fileContainers) const; - void sendDelayedEditorUpdates(const TranslationUnit &translationUnit); void removeTranslationUnits(const QVector &fileContainers); template - EditorUpdatesSendState sendDelayedEditorUpdates(Predicate predicate); + DocumentAnnotationsSendState sendDocumentAnnotations(Predicate predicate); + void sendDocumentAnnotations(const TranslationUnit &translationUnit); private: ClangFileSystemWatcher fileSystemWatcher; - DelayedEditorUpdatesCallback sendDelayedEditorUpdatesCallback; + SendDocumentAnnotationsCallback sendDocumentAnnotationsCallback; std::vector translationUnits_; ProjectParts &projectParts; UnsavedFiles &unsavedFiles_; diff --git a/tests/unit/unittest/mocksendeditorupdatescallback.h b/tests/unit/unittest/mocksenddocumentannotationscallback.h similarity index 80% rename from tests/unit/unittest/mocksendeditorupdatescallback.h rename to tests/unit/unittest/mocksenddocumentannotationscallback.h index 7e13281a544..15ebe7fe72c 100644 --- a/tests/unit/unittest/mocksendeditorupdatescallback.h +++ b/tests/unit/unittest/mocksenddocumentannotationscallback.h @@ -27,27 +27,27 @@ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ -#ifndef MOCKSENDEDITORUPDATESCALLBACK_H -#define MOCKSENDEDITORUPDATESCALLBACK_H +#ifndef MOCKSENDDOCUMENTANNOTATIONSCALLBACK_H +#define MOCKSENDDOCUMENTANNOTATIONSCALLBACK_H #include #include #include #include "gtest-qt-printing.h" -class SendEditorUpdatesCallback +class SendDocumentAnnotationsCallback { public: - virtual ~SendEditorUpdatesCallback() = default; + virtual ~SendDocumentAnnotationsCallback() = default; - virtual void sendEditorUpdates() = 0; + virtual void sendDocumentAnnotations() = 0; }; -class MockSendEditorUpdatesCallback : public SendEditorUpdatesCallback +class MockSendDocumentAnnotationsCallback : public SendDocumentAnnotationsCallback { public: - MOCK_METHOD0(sendEditorUpdates, + MOCK_METHOD0(sendDocumentAnnotations, void()); }; -#endif // MOCKSENDEDITORUPDATESCALLBACK_H +#endif // MOCKSENDDOCUMENTANNOTATIONSCALLBACK_H diff --git a/tests/unit/unittest/translationunitstest.cpp b/tests/unit/unittest/translationunitstest.cpp index d502a51351e..d8a44bff4e0 100644 --- a/tests/unit/unittest/translationunitstest.cpp +++ b/tests/unit/unittest/translationunitstest.cpp @@ -47,7 +47,7 @@ #include -#include "mocksendeditorupdatescallback.h" +#include "mocksenddocumentannotationscallback.h" #include #include @@ -59,7 +59,7 @@ using ClangBackEnd::UnsavedFiles; using ClangBackEnd::ProjectPart; using ClangBackEnd::DiagnosticsChangedMessage; using ClangBackEnd::HighlightingChangedMessage; -using ClangBackEnd::EditorUpdatesSendState; +using ClangBackEnd::DocumentAnnotationsSendState; using testing::IsNull; using testing::NotNull; @@ -87,15 +87,15 @@ class TranslationUnits : public ::testing::Test { protected: void SetUp() override; - void sendAllEditorUpdates(); - void sendAllEditorUpdatesForCurrentEditor(); - void sendAllEditorUpdatesForVisibleEditors(); + void sendAllDocumentAnnotations(); + void sendAllDocumentAnnotationsForCurrentEditor(); + void sendAllDocumentAnnotationsForVisibleEditors(); protected: ClangBackEnd::ProjectParts projects; ClangBackEnd::UnsavedFiles unsavedFiles; ClangBackEnd::TranslationUnits translationUnits{projects, unsavedFiles}; - MockSendEditorUpdatesCallback mockSendEditorUpdatesCallback; + MockSendDocumentAnnotationsCallback mockSendDocumentAnnotationsCallback; const Utf8String filePath = Utf8StringLiteral(TESTDATA_DIR"/translationunits.cpp"); const Utf8String headerPath = Utf8StringLiteral(TESTDATA_DIR"/translationunits.h"); const Utf8String nonExistingFilePath = Utf8StringLiteral("foo.cpp"); @@ -374,55 +374,55 @@ TEST_F(TranslationUnits, IsNotVisibleEditorAfterBeingVisible) ASSERT_FALSE(translationUnit.isVisibleInEditor()); } -TEST_F(TranslationUnits, DoNotSendEditorUpdatesIfThereIsNothingToSend) +TEST_F(TranslationUnits, DoNotSendDocumentAnnotationsIfThereIsNothingToSend) { - EXPECT_CALL(mockSendEditorUpdatesCallback, sendEditorUpdates()).Times(0); + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(0); - sendAllEditorUpdates(); + sendAllDocumentAnnotations(); } -TEST_F(TranslationUnits, SendEditorUpdatessAfterTranslationUnitCreation) +TEST_F(TranslationUnits, SendDocumentAnnotationsAfterTranslationUnitCreation) { translationUnits.create({fileContainer, headerContainer}); - EXPECT_CALL(mockSendEditorUpdatesCallback, sendEditorUpdates()).Times(2); + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(2); - sendAllEditorUpdates(); + sendAllDocumentAnnotations(); } -TEST_F(TranslationUnits, DoNotSendEditorUpdatesAfterGettingEditorUpdates) +TEST_F(TranslationUnits, DoNotSendDocumentAnnotationsAfterGettingDocumentAnnotations) { translationUnits.create({fileContainer, headerContainer}); auto translationUnit = translationUnits.translationUnit(fileContainer); translationUnit.diagnostics(); // Reset translationUnit.highlightingInformations(); // Reset - EXPECT_CALL(mockSendEditorUpdatesCallback, sendEditorUpdates()).Times(1); + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(1); - sendAllEditorUpdates(); + sendAllDocumentAnnotations(); } -TEST_F(TranslationUnits, SendEditorUpdatesForCurrentEditor) +TEST_F(TranslationUnits, SendDocumentAnnotationsForCurrentEditor) { translationUnits.create({fileContainer, headerContainer}); auto translationUnit = translationUnits.translationUnit(fileContainer); translationUnit.setIsUsedByCurrentEditor(true); - EXPECT_CALL(mockSendEditorUpdatesCallback, sendEditorUpdates()).Times(1); + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(1); - sendAllEditorUpdatesForCurrentEditor(); + sendAllDocumentAnnotationsForCurrentEditor(); } -TEST_F(TranslationUnits, DoNotSendEditorUpdatesForCurrentEditorIfThereIsNoCurrentEditor) +TEST_F(TranslationUnits, DoNotSendDocumentAnnotationsForCurrentEditorIfThereIsNoCurrentEditor) { translationUnits.create({fileContainer, headerContainer}); - EXPECT_CALL(mockSendEditorUpdatesCallback, sendEditorUpdates()).Times(0); + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(0); - sendAllEditorUpdatesForCurrentEditor(); + sendAllDocumentAnnotationsForCurrentEditor(); } -TEST_F(TranslationUnits, DoNotSendEditorUpdatesForCurrentEditorAfterGettingEditorUpdates) +TEST_F(TranslationUnits, DoNotSendDocumentAnnotationsForCurrentEditorAfterGettingDocumentAnnotations) { translationUnits.create({fileContainer, headerContainer}); auto translationUnit = translationUnits.translationUnit(fileContainer); @@ -430,21 +430,21 @@ TEST_F(TranslationUnits, DoNotSendEditorUpdatesForCurrentEditorAfterGettingEdito translationUnit.diagnostics(); // Reset translationUnit.highlightingInformations(); // Reset - EXPECT_CALL(mockSendEditorUpdatesCallback, sendEditorUpdates()).Times(0); + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(0); - sendAllEditorUpdatesForCurrentEditor(); + sendAllDocumentAnnotationsForCurrentEditor(); } -TEST_F(TranslationUnits, DoNotSendEditorUpdatesForVisibleEditorIfThereAreNoVisibleEditors) +TEST_F(TranslationUnits, DoNotSendDocumentAnnotationsForVisibleEditorIfThereAreNoVisibleEditors) { translationUnits.create({fileContainer, headerContainer}); - EXPECT_CALL(mockSendEditorUpdatesCallback, sendEditorUpdates()).Times(0); + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(0); - translationUnits.sendDelayedEditorUpdatesForVisibleEditors(); + translationUnits.sendDocumentAnnotationsForVisibleEditors(); } -TEST_F(TranslationUnits, SendEditorUpdatesForVisibleEditors) +TEST_F(TranslationUnits, SendDocumentAnnotationsForVisibleEditors) { translationUnits.create({fileContainer, headerContainer}); auto fileTranslationUnit = translationUnits.translationUnit(fileContainer); @@ -452,12 +452,12 @@ TEST_F(TranslationUnits, SendEditorUpdatesForVisibleEditors) auto headerTranslationUnit = translationUnits.translationUnit(headerContainer); headerTranslationUnit.setIsVisibleInEditor(true); - EXPECT_CALL(mockSendEditorUpdatesCallback, sendEditorUpdates()).Times(2); + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(2); - sendAllEditorUpdatesForVisibleEditors(); + sendAllDocumentAnnotationsForVisibleEditors(); } -TEST_F(TranslationUnits, SendOnlyOneEditorUpdateForVisibleEditor) +TEST_F(TranslationUnits, SendDocumentAnnotationsOnlyOnceForVisibleEditor) { translationUnits.create({fileContainer, headerContainer}); auto fileTranslationUnit = translationUnits.translationUnit(fileContainer); @@ -467,9 +467,9 @@ TEST_F(TranslationUnits, SendOnlyOneEditorUpdateForVisibleEditor) headerTranslationUnit.diagnostics(); // Reset headerTranslationUnit.highlightingInformations(); // Reset - EXPECT_CALL(mockSendEditorUpdatesCallback, sendEditorUpdates()).Times(1); + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(1); - sendAllEditorUpdatesForVisibleEditors(); + sendAllDocumentAnnotationsForVisibleEditors(); } void TranslationUnits::SetUp() @@ -477,33 +477,33 @@ void TranslationUnits::SetUp() projects.createOrUpdate({ClangBackEnd::ProjectPartContainer(projectPartId)}); auto callback = [&] (const DiagnosticsChangedMessage &, const HighlightingChangedMessage &) { - mockSendEditorUpdatesCallback.sendEditorUpdates(); + mockSendDocumentAnnotationsCallback.sendDocumentAnnotations(); }; - translationUnits.setSendDelayedEditorUpdatesCallback(callback); + translationUnits.setSendDocumentAnnotationsCallback(callback); } -void TranslationUnits::sendAllEditorUpdates() +void TranslationUnits::sendAllDocumentAnnotations() { - auto editorUpdatesSendState = EditorUpdatesSendState::MaybeThereAreMoreEditorUpdates; + auto sendState = DocumentAnnotationsSendState::MaybeThereAreDocumentAnnotations; - while (editorUpdatesSendState == EditorUpdatesSendState::MaybeThereAreMoreEditorUpdates) - editorUpdatesSendState = translationUnits.sendDelayedEditorUpdates(); + while (sendState == DocumentAnnotationsSendState::MaybeThereAreDocumentAnnotations) + sendState = translationUnits.sendDocumentAnnotations(); } -void TranslationUnits::sendAllEditorUpdatesForCurrentEditor() +void TranslationUnits::sendAllDocumentAnnotationsForCurrentEditor() { - auto editorUpdatesSendState = EditorUpdatesSendState::MaybeThereAreMoreEditorUpdates; + auto sendState = DocumentAnnotationsSendState::MaybeThereAreDocumentAnnotations; - while (editorUpdatesSendState == EditorUpdatesSendState::MaybeThereAreMoreEditorUpdates) - editorUpdatesSendState = translationUnits.sendDelayedEditorUpdatesForCurrentEditor(); + while (sendState == DocumentAnnotationsSendState::MaybeThereAreDocumentAnnotations) + sendState = translationUnits.sendDocumentAnnotationsForCurrentEditor(); } -void TranslationUnits::sendAllEditorUpdatesForVisibleEditors() +void TranslationUnits::sendAllDocumentAnnotationsForVisibleEditors() { - auto editorUpdatesSendState = EditorUpdatesSendState::MaybeThereAreMoreEditorUpdates; + auto sendState = DocumentAnnotationsSendState::MaybeThereAreDocumentAnnotations; - while (editorUpdatesSendState == EditorUpdatesSendState::MaybeThereAreMoreEditorUpdates) - editorUpdatesSendState = translationUnits.sendDelayedEditorUpdatesForVisibleEditors(); + while (sendState == DocumentAnnotationsSendState::MaybeThereAreDocumentAnnotations) + sendState = translationUnits.sendDocumentAnnotationsForVisibleEditors(); } } diff --git a/tests/unit/unittest/unittest.pro b/tests/unit/unittest/unittest.pro index de135d251eb..d3cefda9da0 100644 --- a/tests/unit/unittest/unittest.pro +++ b/tests/unit/unittest/unittest.pro @@ -68,6 +68,6 @@ HEADERS += \ spydummy.h \ matcher-diagnosticcontainer.h \ chunksreportedmonitor.h \ - mocksendeditorupdatescallback.h + mocksenddocumentannotationscallback.h OTHER_FILES += $$files(data/*)