remove LOCAL_VARIABLE highlight on top of BACKING_FIELD_VARIABLE

This commit is contained in:
Dmitry Jemerov
2016-05-25 13:22:45 +02:00
parent 4261e4a5cc
commit b51637d49f
3 changed files with 7 additions and 6 deletions
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.descriptors.VariableDescriptor
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor
import org.jetbrains.kotlin.idea.highlighter.KotlinHighlightingColors.*
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.renderer.DescriptorRenderer
@@ -124,12 +125,12 @@ internal class VariablesHighlightingVisitor(holder: AnnotationHolder, bindingCon
holder.createInfoAnnotation(elementToHighlight, msg).textAttributes = WRAPPED_INTO_REF
}
if (descriptor is LocalVariableDescriptor) {
NameHighlighter.highlightName(holder, elementToHighlight, LOCAL_VARIABLE)
if (descriptor is LocalVariableDescriptor && descriptor !is SyntheticFieldDescriptor) {
holder.highlightName(elementToHighlight, LOCAL_VARIABLE)
}
if (descriptor is ValueParameterDescriptor) {
NameHighlighter.highlightName(holder, elementToHighlight, PARAMETER)
holder.highlightName(elementToHighlight, PARAMETER)
}
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
var <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE">my</info></info> = 0
<info textAttributesKey="KOTLIN_KEYWORD">get</info>() = <info textAttributesKey="KOTLIN_BACKING_FIELD_VARIABLE"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE"><info textAttributesKey="KOTLIN_LOCAL_VARIABLE">field</info></info></info>
<info textAttributesKey="KOTLIN_KEYWORD">get</info>() = <info textAttributesKey="KOTLIN_BACKING_FIELD_VARIABLE"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE">field</info></info>
<info textAttributesKey="KOTLIN_KEYWORD">set</info>(<info textAttributesKey="KOTLIN_PARAMETER">arg</info>) {
<info textAttributesKey="KOTLIN_BACKING_FIELD_VARIABLE"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE"><info textAttributesKey="KOTLIN_LOCAL_VARIABLE">field</info></info></info> = <info textAttributesKey="KOTLIN_PARAMETER">arg</info> + 1
<info textAttributesKey="KOTLIN_BACKING_FIELD_VARIABLE"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE">field</info></info> = <info textAttributesKey="KOTLIN_PARAMETER">arg</info> + 1
}
fun <info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">foo</info>(): <info textAttributesKey="KOTLIN_CLASS">Int</info> {
+1 -1
View File
@@ -7,7 +7,7 @@ val <info textAttributesKey="KOTLIN_CLASS">Int</info>.<info textAttributesKey="K
val <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY">y</info> : <info textAttributesKey="KOTLIN_CLASS">Int</info> = 1
<info textAttributesKey="KOTLIN_KEYWORD">get</info>() {
return 5.<info textAttributesKey="KOTLIN_EXTENSION_PROPERTY">sq</info> + <info textAttributesKey="KOTLIN_LOCAL_VARIABLE"><info textAttributesKey="KOTLIN_BACKING_FIELD_VARIABLE">field</info></info> + <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE">x</info></info>
return 5.<info textAttributesKey="KOTLIN_EXTENSION_PROPERTY">sq</info> + <info textAttributesKey="KOTLIN_BACKING_FIELD_VARIABLE">field</info> + <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE">x</info></info>
}
class <info textAttributesKey="KOTLIN_CLASS">Foo</info>(val <info textAttributesKey="KOTLIN_PARAMETER"><info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">a</info></info> : <info textAttributesKey="KOTLIN_CLASS">Int</info>, <info textAttributesKey="KOTLIN_PARAMETER">b</info> : <info textAttributesKey="KOTLIN_CLASS">String</info>) {