Android Extensions: Add synthetic property highlighting

This commit is contained in:
Yan Zhulanow
2017-05-27 00:00:11 +03:00
parent f7786a42ab
commit 942fa7719a
5 changed files with 8 additions and 0 deletions
+1
View File
@@ -36,5 +36,6 @@
<orderEntry type="module" module-name="descriptors" />
<orderEntry type="library" exported="" name="idea-full" level="project" />
<orderEntry type="library" name="uast-java" level="project" />
<orderEntry type="module" module-name="android-extensions-compiler" />
</component>
</module>
@@ -80,6 +80,7 @@ options.kotlin.attribute.descriptor.package.property=Properties and Variables//P
options.kotlin.attribute.descriptor.field=Properties and Variables//Backing field variable
options.kotlin.attribute.descriptor.extension.property=Properties and Variables//Extension property
options.kotlin.attribute.descriptor.dynamic.property=Properties and Variables//Dynamic property
options.kotlin.attribute.descriptor.android.extensions.property=Properties and Variables//Android Extensions synthetic properties
options.kotlin.attribute.descriptor.it=Parameters//Lambda expression default parameter
options.kotlin.attribute.descriptor.fun=Functions//Function declaration
options.kotlin.attribute.descriptor.fun.call=Functions//Function call
@@ -66,6 +66,7 @@ public class KotlinHighlightingColors {
public static final TextAttributesKey BACKING_FIELD_VARIABLE = createTextAttributesKey("KOTLIN_BACKING_FIELD_VARIABLE");
public static final TextAttributesKey EXTENSION_PROPERTY = createTextAttributesKey("KOTLIN_EXTENSION_PROPERTY", DefaultLanguageHighlighterColors.STATIC_FIELD);
public static final TextAttributesKey DYNAMIC_PROPERTY_CALL = createTextAttributesKey("KOTLIN_DYNAMIC_PROPERTY_CALL");
public static final TextAttributesKey ANDROID_EXTENSIONS_PROPERTY_CALL = createTextAttributesKey("KOTLIN_ANDROID_EXTENSIONS_PROPERTY_CALL");
// functions
public static final TextAttributesKey FUNCTION_LITERAL_DEFAULT_PARAMETER = createTextAttributesKey("KOTLIN_CLOSURE_DEFAULT_PARAMETER");
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea.highlighter
import com.intellij.lang.annotation.AnnotationHolder
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.android.synthetic.res.AndroidSyntheticProperty
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor
import org.jetbrains.kotlin.idea.highlighter.KotlinHighlightingColors.*
@@ -76,6 +77,9 @@ internal class PropertiesHighlightingVisitor(holder: AnnotationHolder, bindingCo
descriptor.isDynamic() ->
DYNAMIC_PROPERTY_CALL
descriptor is AndroidSyntheticProperty ->
ANDROID_EXTENSIONS_PROPERTY_CALL
descriptor.extensionReceiverParameter != null ->
EXTENSION_PROPERTY
@@ -146,6 +146,7 @@ var <PACKAGE_PROPERTY><MUTABLE_VARIABLE>globalCounter</MUTABLE_VARIABLE></PACKAG
KotlinBundle.message("options.kotlin.attribute.descriptor.field") to KotlinHighlightingColors.BACKING_FIELD_VARIABLE,
KotlinBundle.message("options.kotlin.attribute.descriptor.extension.property") to KotlinHighlightingColors.EXTENSION_PROPERTY,
KotlinBundle.message("options.kotlin.attribute.descriptor.dynamic.property") to KotlinHighlightingColors.DYNAMIC_PROPERTY_CALL,
KotlinBundle.message("options.kotlin.attribute.descriptor.android.extensions.property") to KotlinHighlightingColors.ANDROID_EXTENSIONS_PROPERTY_CALL,
KotlinBundle.message("options.kotlin.attribute.descriptor.it") to KotlinHighlightingColors.FUNCTION_LITERAL_DEFAULT_PARAMETER,
KotlinBundle.message("options.kotlin.attribute.descriptor.fun") to KotlinHighlightingColors.FUNCTION_DECLARATION,
KotlinBundle.message("options.kotlin.attribute.descriptor.fun.call") to KotlinHighlightingColors.FUNCTION_CALL,