From 1cea268c9298ffd9477ab00f6507613286de8c59 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 24 Apr 2020 15:10:53 +0200 Subject: [PATCH] QmlJSEditor: Fix semantic highlighting Do not send empty ranges as they may mess up the highlighting of the file. Fixes: QTCREATORBUG-23729 Change-Id: I77adcccb3a3da890e87f0b2860b945819446a3a8 Reviewed-by: Ulf Hermann --- src/plugins/qmljseditor/qmljssemantichighlighter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index 65e9b0ca2e5..b9ef9dc7469 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -269,8 +269,11 @@ protected: } } - if (type != SemanticHighlighter::UnknownType) - addUse(location, type); + if (type != SemanticHighlighter::UnknownType) { + // do not add uses of length 0 - this messes up highlighting (e.g. anon functions) + if (location.length != 0) + addUse(location, type); + } } void processTypeId(UiQualifiedId *typeId)