Don't apply highlighting to zero-length elements

#KT-19820 Fixed
This commit is contained in:
Dmitry Jemerov
2017-12-19 18:10:09 +01:00
parent 52ccfcecfc
commit d3adf57145
2 changed files with 6 additions and 1 deletions
@@ -36,7 +36,7 @@ abstract class HighlightingVisitor protected constructor(
holder.createInfoAnnotation(textRange, message)
protected fun highlightName(element: PsiElement, attributesKey: TextAttributesKey, message: String? = null) {
if (NameHighlighter.namesHighlightingEnabled) {
if (NameHighlighter.namesHighlightingEnabled && !element.textRange.isEmpty) {
createInfoAnnotation(element, message).textAttributes = attributesKey
}
}
+5
View File
@@ -5,6 +5,11 @@ package testing
<info textAttributesKey="KOTLIN_ENUM_ENTRY">SECOND</info>
}
<info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">enum</info> class <info textAttributesKey="KOTLIN_CLASS">Type</info>(val <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">id</info>: <info textAttributesKey="KOTLIN_CLASS">Int</info>) {
<info textAttributesKey="KOTLIN_ENUM_ENTRY">FIRST</info>(1),
<info textAttributesKey="KOTLIN_ENUM_ENTRY">SECOND</info>(2)
}
fun <info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">testing</info>(<info textAttributesKey="KOTLIN_PARAMETER">t1</info>: <info textAttributesKey="KOTLIN_CLASS">Test</info>, <info textAttributesKey="KOTLIN_PARAMETER">t2</info>: <info textAttributesKey="KOTLIN_CLASS">Test</info>): <info textAttributesKey="KOTLIN_CLASS">Test</info> {
if (<info textAttributesKey="KOTLIN_PARAMETER">t1</info> != <info textAttributesKey="KOTLIN_PARAMETER">t2</info>) return <info textAttributesKey="KOTLIN_CLASS">Test</info>.<info textAttributesKey="KOTLIN_ENUM_ENTRY">FIRST</info>
return <info textAttributesKey="KOTLIN_PACKAGE_FUNCTION_CALL">testing</info>(<info textAttributesKey="KOTLIN_CLASS">Test</info>.<info textAttributesKey="KOTLIN_ENUM_ENTRY">FIRST</info>, <info textAttributesKey="KOTLIN_CLASS">Test</info>.<info textAttributesKey="KOTLIN_ENUM_ENTRY">SECOND</info>)