ClangCodeModel: Handle UI header updates with clangd

We need to manually refresh the documents that include the generated
header, as clangd does not know about it.

Change-Id: I8c4303ac029bbb56c01aa99b7950dcc651701678
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-11-12 11:33:07 +01:00
parent d2c378ef75
commit 95e8afabba
3 changed files with 28 additions and 0 deletions

View File

@@ -608,6 +608,7 @@ void ClangModelManagerSupport::onAbstractEditorSupportContentsUpdated(const QStr
const QString mappedPath = m_uiHeaderOnDiskManager.write(filePath, content);
m_communicator.unsavedFilesUpdated(mappedPath, content, 0);
ClangdClient::handleUiHeaderChange(Utils::FilePath::fromString(filePath).fileName());
}
void ClangModelManagerSupport::onAbstractEditorSupportRemoved(const QString &filePath)
@@ -618,6 +619,7 @@ void ClangModelManagerSupport::onAbstractEditorSupportRemoved(const QString &fil
const QString mappedPath = m_uiHeaderOnDiskManager.remove(filePath);
const QString projectPartId = projectPartIdForFile(filePath);
m_communicator.unsavedFilesRemoved({{mappedPath, projectPartId}});
ClangdClient::handleUiHeaderChange(Utils::FilePath::fromString(filePath).fileName());
}
}