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 <ulf.hermann@qt.io>
This commit is contained in:
Christian Stenger
2020-04-24 15:10:53 +02:00
parent f2b9bdd9f2
commit 1cea268c92

View File

@@ -269,9 +269,12 @@ protected:
}
}
if (type != SemanticHighlighter::UnknownType)
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)
{