diff options
author | Christian Kandeler <[email protected]> | 2024-03-01 13:43:27 +0100 |
---|---|---|
committer | Christian Kandeler <[email protected]> | 2024-03-04 10:36:53 +0000 |
commit | f56fd04c8dbbfead7800a1612fb0d1fd05ceeca6 (patch) | |
tree | 394396912519f8f50ec3d84c0f0cbf465232d723 /src/plugins | |
parent | cf8a8974eda296ba82925bb3f2c0d2cfa1a4bc1b (diff) |
Revert "Clangd: Avoid client restart after modifying open documents"
The whole point of tracking external changes to files is to use the open
files as a sentinel to indicate that non-open files (on which we don't
have a watch) have likely also been changed.
This reverts commit cff26d813a8805c34588536ca19453852b946643.
Change-Id: I5a8b3e6709eda881b912916cf0838b45d1ff4fa4
Reviewed-by: David Schulz <[email protected]>
Reviewed-by: <[email protected]>
Reviewed-by: Qt CI Bot <[email protected]>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/clangcodemodel/clangmodelmanagersupport.cpp | 5 | ||||
-rw-r--r-- | src/plugins/clangcodemodel/test/clangdtests.cpp | 10 |
2 files changed, 8 insertions, 7 deletions
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<ClangdClient>()) 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())); } |