forked from qt-creator/qt-creator
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 cff26d813a
.
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>
This commit is contained in:
@@ -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;
|
||||
|
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user