From 8d47a2f1e953e0cbda78fa8a8687572c096857de Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 10 Nov 2021 17:51:27 +0100 Subject: [PATCH] CppEditor: Add more logging to semantic highlighter Change-Id: Ib862d0290700e4e3ed42e7359b3ac902d64ba650 Reviewed-by: David Schulz --- src/plugins/cppeditor/semantichighlighter.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/plugins/cppeditor/semantichighlighter.cpp b/src/plugins/cppeditor/semantichighlighter.cpp index ba8b81e7ff1..d1e4e678257 100644 --- a/src/plugins/cppeditor/semantichighlighter.cpp +++ b/src/plugins/cppeditor/semantichighlighter.cpp @@ -148,6 +148,7 @@ void SemanticHighlighter::run() connectWatcher(); m_revision = documentRevision(); + qCDebug(log) << "starting runner for document revision" << m_revision; m_watcher->setFuture(m_highlightingRunner()); } @@ -160,12 +161,17 @@ static Parentheses getClearedParentheses(const QTextBlock &block) 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; + 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; t.start();