Clangd: Avoid client restart after modifying open documents

Change-Id: I116eed1b047159e3d1ce64f18f44da6a0ad7b231
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2023-11-16 10:13:05 +01:00
parent 7affb80fc3
commit cff26d813a
2 changed files with 7 additions and 8 deletions

View File

@@ -2052,21 +2052,15 @@ 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 a new client and diagnostics in the current editor.
// verify that we get 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(newClient, &ClangdClient::textMarkCreated, timeOutInMs()));
QVERIFY(waitForSignalOrTimeout(client(), &ClangdClient::textMarkCreated, timeOutInMs()));
}
ClangdTestIndirectChanges::ClangdTestIndirectChanges()