forked from qt-creator/qt-creator
ClangCodeModel: Make "live update" of dependent sources opt-in
Not everyone wants to invest the extra computing resources needed for this feature. Amendsb33b99e2d9. See6d805195f6for the original motivation. Task-number: QTCREATORBUG-29943 Change-Id: I4c8cce5bb58b34d930a409ea3e0995377c90d4ab Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <languageclient/languageclientmanager.h>
|
||||
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
|
||||
#include <texteditor/fontsettings.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
@@ -84,7 +86,12 @@ void ClangEditorDocumentProcessor::forceUpdate(TextEditor::TextDocument *doc)
|
||||
{
|
||||
if (const auto client = qobject_cast<ClangdClient *>(
|
||||
LanguageClient::LanguageClientManager::clientForDocument(doc))) {
|
||||
client->documentContentsChanged(doc, 0, 0, 0);
|
||||
const CppEditor::ClangdSettings settings(
|
||||
CppEditor::ClangdProjectSettings(
|
||||
ProjectExplorer::ProjectManager::projectForFile(doc->filePath()))
|
||||
.settings());
|
||||
if (settings.updateDependentSources())
|
||||
client->documentContentsChanged(doc, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2240,6 +2240,8 @@ public:
|
||||
ClangdTestIndirectChanges();
|
||||
|
||||
private slots:
|
||||
void initTestCase() override;
|
||||
void cleanupTestCase();
|
||||
void test();
|
||||
};
|
||||
|
||||
@@ -2249,6 +2251,20 @@ ClangdTestIndirectChanges::ClangdTestIndirectChanges()
|
||||
setSourceFileNames({"main.cpp", "directheader.h", "indirectheader.h", "unrelatedheader.h"});
|
||||
}
|
||||
|
||||
void ClangdTestIndirectChanges::initTestCase()
|
||||
{
|
||||
CppEditor::ClangdSettings &settings = CppEditor::ClangdSettings::instance();
|
||||
CppEditor::ClangdSettings::Data settingsData = settings.data();
|
||||
settingsData.updateDependentSources = true;
|
||||
settings.setData(settingsData, false);
|
||||
ClangdTest::initTestCase();
|
||||
}
|
||||
|
||||
void ClangdTestIndirectChanges::cleanupTestCase()
|
||||
{
|
||||
CppEditor::ClangdSettings::instance().setData({}, false);
|
||||
}
|
||||
|
||||
void ClangdTestIndirectChanges::test()
|
||||
{
|
||||
// Initially, everything is fine.
|
||||
|
||||
Reference in New Issue
Block a user