aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangcodemodel
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2024-03-01 13:43:27 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2024-03-04 10:36:53 +0000
commitf56fd04c8dbbfead7800a1612fb0d1fd05ceeca6 (patch)
tree394396912519f8f50ec3d84c0f0cbf465232d723 /src/plugins/clangcodemodel
parentcf8a8974eda296ba82925bb3f2c0d2cfa1a4bc1b (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 <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/plugins/clangcodemodel')
-rw-r--r--src/plugins/clangcodemodel/clangmodelmanagersupport.cpp5
-rw-r--r--src/plugins/clangcodemodel/test/clangdtests.cpp10
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()));
}