diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp index 477ab9104b9..3cf94e19c7c 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp @@ -796,11 +796,6 @@ void ClangModelManagerSupport::watchForExternalChanges() if (!LanguageClientManager::hasClients()) return; for (const FilePath &file : files) { - if (TextEditor::TextDocument::textDocumentForFilePath(file)) { - // if we have a document for that file we should receive the content - // change via the document signals - continue; - } const ProjectFile::Kind kind = ProjectFile::classify(file.toString()); if (!ProjectFile::isSource(kind) && !ProjectFile::isHeader(kind)) continue; diff --git a/src/plugins/clangcodemodel/test/clangdtests.cpp b/src/plugins/clangcodemodel/test/clangdtests.cpp index 1edec4c2905..bfe7ea95368 100644 --- a/src/plugins/clangcodemodel/test/clangdtests.cpp +++ b/src/plugins/clangcodemodel/test/clangdtests.cpp @@ -2207,15 +2207,21 @@ void ClangdTestExternalChanges::test() QVERIFY(curDoc->marks().isEmpty()); // Now trigger an external change in an open, but not currently visible file and - // verify that we get diagnostics in the current editor. + // verify that we get a new client and diagnostics in the current editor. TextDocument * const docToChange = document("mainwindow.cpp"); docToChange->setSilentReload(); QFile otherSource(filePath("mainwindow.cpp").toString()); QVERIFY(otherSource.open(QIODevice::WriteOnly)); otherSource.write("blubb"); otherSource.close(); + QVERIFY(waitForSignalOrTimeout(LanguageClientManager::instance(), + &LanguageClientManager::clientAdded, timeOutInMs())); + ClangdClient * const newClient = ClangModelManagerSupport::clientForProject(project()); + QVERIFY(newClient); + QVERIFY(newClient != oldClient); + newClient->enableTesting(); if (curDoc->marks().isEmpty()) - QVERIFY(waitForSignalOrTimeout(client(), &ClangdClient::textMarkCreated, timeOutInMs())); + QVERIFY(waitForSignalOrTimeout(newClient, &ClangdClient::textMarkCreated, timeOutInMs())); }