forked from qt-creator/qt-creator
Clang: Rebuild overview model tree when token data is updated
In release builds overview model tree is built earlier then the job with token information is completed. Change-Id: I1a563551e813996001fb97924ac441e2b7d599b9 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -267,6 +267,7 @@ void ClangEditorDocumentProcessor::updateTokenInfos(
|
||||
if (documentRevision != revision())
|
||||
return;
|
||||
m_tokenInfos = tokenInfos;
|
||||
emit tokenInfosUpdated();
|
||||
}
|
||||
|
||||
static int currentLine(const TextEditor::AssistInterface &assistInterface)
|
||||
|
||||
@@ -106,6 +106,9 @@ public:
|
||||
public:
|
||||
static ClangEditorDocumentProcessor *get(const QString &filePath);
|
||||
|
||||
signals:
|
||||
void tokenInfosUpdated();
|
||||
|
||||
private:
|
||||
void onParserFinished();
|
||||
void updateProjectPartAndTranslationUnitForEditor();
|
||||
|
||||
@@ -206,7 +206,19 @@ bool OverviewModel::rebuild(const QString &filePath)
|
||||
ClangEditorDocumentProcessor *processor = ClangEditorDocumentProcessor::get(filePath);
|
||||
if (!processor)
|
||||
return false;
|
||||
m_filePath = filePath;
|
||||
if (m_filePath != filePath) {
|
||||
if (!m_filePath.isEmpty()) {
|
||||
ClangEditorDocumentProcessor *previousProcessor
|
||||
= ClangEditorDocumentProcessor::get(m_filePath);
|
||||
if (previousProcessor) {
|
||||
disconnect(previousProcessor, &ClangEditorDocumentProcessor::tokenInfosUpdated,
|
||||
this, &OverviewModel::needsUpdate);
|
||||
}
|
||||
}
|
||||
m_filePath = filePath;
|
||||
connect(processor, &ClangEditorDocumentProcessor::tokenInfosUpdated, this,
|
||||
&OverviewModel::needsUpdate);
|
||||
}
|
||||
|
||||
const TokenContainers &tokenContainers = processor->tokenInfos();
|
||||
auto *root = new TokenTreeItem;
|
||||
|
||||
Reference in New Issue
Block a user