forked from qt-creator/qt-creator
Clang: Request new diagnostics after reload
Diagnostics should be not computed after a file change but after creator is requesting them. Now we wait for the dialog if the file should be reloaded. Change-Id: Id0d51874b95e0f8743002a91511d07e0ed47ecdc Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -459,6 +459,17 @@ void IpcCommunicator::requestDiagnostics(const FileContainer &fileContainer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IpcCommunicator::requestDiagnostics(Core::IDocument *document)
|
||||||
|
{
|
||||||
|
const auto textDocument = qobject_cast<TextDocument*>(document);
|
||||||
|
const auto filePath = textDocument->filePath().toString();
|
||||||
|
const QString projectPartId = Utils::projectPartIdForFile(filePath);
|
||||||
|
|
||||||
|
requestDiagnostics(FileContainer(filePath,
|
||||||
|
projectPartId,
|
||||||
|
textDocument->document()->revision()));
|
||||||
|
}
|
||||||
|
|
||||||
void IpcCommunicator::updateChangeContentStartPosition(const QString &filePath, int position)
|
void IpcCommunicator::updateChangeContentStartPosition(const QString &filePath, int position)
|
||||||
{
|
{
|
||||||
auto *document = cppDocument(filePath);
|
auto *document = cppDocument(filePath);
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ public:
|
|||||||
void updateTranslationUnit(const QString &filePath, const QByteArray &contents, uint documentRevision);
|
void updateTranslationUnit(const QString &filePath, const QByteArray &contents, uint documentRevision);
|
||||||
void updateUnsavedFile(const QString &filePath, const QByteArray &contents, uint documentRevision);
|
void updateUnsavedFile(const QString &filePath, const QByteArray &contents, uint documentRevision);
|
||||||
void requestDiagnostics(const ClangBackEnd::FileContainer &fileContainer);
|
void requestDiagnostics(const ClangBackEnd::FileContainer &fileContainer);
|
||||||
|
void requestDiagnostics(Core::IDocument *document);
|
||||||
void updateChangeContentStartPosition(const QString &filePath, int position);
|
void updateChangeContentStartPosition(const QString &filePath, int position);
|
||||||
|
|
||||||
public: // for tests
|
public: // for tests
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ void ModelManagerSupportClang::onCppDocumentReloadFinishedOnTranslationUnit(bool
|
|||||||
{
|
{
|
||||||
if (success) {
|
if (success) {
|
||||||
Core::IDocument *document = qobject_cast<Core::IDocument *>(sender());
|
Core::IDocument *document = qobject_cast<Core::IDocument *>(sender());
|
||||||
m_ipcCommunicator.updateTranslationUnit(document);
|
m_ipcCommunicator.requestDiagnostics(document);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user