CppEditor: Add more logging to semantic highlighter

Change-Id: Ib862d0290700e4e3ed42e7359b3ac902d64ba650
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-11-10 17:51:27 +01:00
parent af647841cf
commit 8d47a2f1e9

View File

@@ -148,6 +148,7 @@ void SemanticHighlighter::run()
connectWatcher(); connectWatcher();
m_revision = documentRevision(); m_revision = documentRevision();
qCDebug(log) << "starting runner for document revision" << m_revision;
m_watcher->setFuture(m_highlightingRunner()); m_watcher->setFuture(m_highlightingRunner());
} }
@@ -160,12 +161,17 @@ static Parentheses getClearedParentheses(const QTextBlock &block)
void SemanticHighlighter::onHighlighterResultAvailable(int from, int to) void SemanticHighlighter::onHighlighterResultAvailable(int from, int to)
{ {
if (documentRevision() != m_revision)
return; // outdated
if (!m_watcher || m_watcher->isCanceled())
return; // aborted
qCDebug(log) << "onHighlighterResultAvailable()" << from << to; qCDebug(log) << "onHighlighterResultAvailable()" << from << to;
if (documentRevision() != m_revision) {
qCDebug(log) << "ignoring results: revision changed from" << m_revision << "to"
<< documentRevision();
return;
}
if (!m_watcher || m_watcher->isCanceled()) {
qCDebug(log) << "ignoring results: future was canceled";
return;
}
QElapsedTimer t; QElapsedTimer t;
t.start(); t.start();